Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

Chapter 6 — Working with Existing Address Information 99


type=”text/javascript”><table cellpadding=0 cellspacing=0 border=0 ;
class=”staticmap”>
...


To extract the information you can use Perl (or any other language) to send the query and
then use a suitable regular expression on the returned data to extract the latitude and longitude
information required. The key you are looking for in this case is the GLatLngfragment in the
response:


map.setCenter(new GLatLng(40.714167, -74.006389), zoom);


Extracting that information with a regular expression is comparatively straightforward.


A simple script (using Perl) to perform the necessary steps is shown in Listing 6-3.


Listing 6-3:Using Google to Geocode Information

#!/usr/bin/perl


use strict;
use LWP::UserAgent;


Continued
Free download pdf