Changeset 886


Ignore:
Timestamp:
Nov 23, 2006, 7:04:35 PM (15 years ago)
Author:
Dominic Hargreaves
Message:

Allow a Google Maps URL to be pasted to provide the centre long,lat coords (paulm)

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Build.PL

    r882 r886  
    7373my $install_directory; # used to suggest template paths
    7474my $use_plucene = 1; # keep track of this so we know what to put in prereqs
     75my $centre_lat = ''; # contains centre lat derived from Google Maps URL
    7576foreach my $var ( qw(
    7677   dbname dbuser dbpass dbhost script_name
     
    128129    }
    129130
     131    # If a Google Maps URL was provided last time we know the centre_lat
     132    if ( $var eq 'centre_lat' && $centre_lat ) {
     133        $val = $centre_lat;
     134        next;
     135    }   
     136
    130137    # Here is where we actually ask the questions.
    131138    unless ( $skip_config ) {
     
    138145        } else {
    139146            $val = Module::Build->prompt("\n$qu ", $def);
     147        }
     148    }
     149
     150    # Allow user to use a Google Maps URL rather than enter lat/long by hand.
     151    # We assume centre_long is being asked for first; ensure so in big list above.
     152    if ( $var eq 'centre_long' ) {
     153        if ( $val =~ /ll=([-\d.]+),([-\d.]+)/ ) {
     154            print "Got a Google Maps URL with centre long,lat: [$1, $2]\n";
     155            $val = $1;
     156            $centre_lat = $2;
    140157        }
    141158    }
  • trunk/INSTALL

    r845 r886  
    205205  "What is the latitude of the centre point of a map to draw for your guide?"
    206206
    207 It's probably a good idea to pick some notionally central point for your
    208 guide. For example, Carfax for Oxford, Charing Cross for London.
     207It's probably a good idea to pick some notionally central point for your
     208guide. For example, Carfax for Oxford, Charing Cross for London. As a
     209convenience, you may paste in a Google Maps URL for the centre longitude
     210question and the (long,lat) will be parsed out from the URL.
    209211
    210212  "What default zoom level shall we use for Google Maps?"
  • trunk/lib/OpenGuides/Config.pm

    r874 r886  
    160160        ellipsoid => "Which ellipsoid do you want to use? (eg 'Airy', 'WGS-84')",
    161161        gmaps_api_key => "Do you have a Google Maps API key to use with this guide? If you enter it here the Google Maps functionality will be automatically enabled.",
    162         centre_long => "What is the longitude of the centre point of a map to draw for your guide? (This question can be ignored if you aren't using Google Maps)",
     162        centre_long => "What is the longitude of the centre point of a map to draw for your guide? (This question can be ignored if you aren't using Google Maps). You may paste in a Google Maps URL here (hint: copy URL from 'Link to this page')",
    163163        centre_lat => "What is the latitude of the centre point of a map to draw for your guide? (This question can be ignored if you aren't using Google Maps)",
    164164        default_gmaps_zoom => "What default zoom level shall we use for Google Maps? (This question can be ignored if you aren't using Google Maps)",
Note: See TracChangeset for help on using the changeset viewer.