F
Faith Greenwood
I am trying to do some geocoding w/ geo::coder::google. It works fine
but my problem is accessing the values in the hash. How can I return
the coordinates (ie '-122.397323','37.778993',)?
#here is the hash (as posted on CSPAN page for Geo::Coder::Google)
##Link for a more legible version:
http://search.cpan.org/~miyagawa/Geo-Coder-Google-0.06/lib/Geo/Coder/Google.pm
{
'AddressDetails' => {
'Country' => {
'AdministrativeArea' => {
'SubAdministrativeArea' => {
'SubAdministrativeAreaName' => 'San Francisco',
'Locality' => {
'PostalCode' => {
'PostalCodeNumber' => '94107'
},
'LocalityName' => 'San Francisco',
'Thoroughfare' => {
'ThoroughfareName' => '548 4th St'
}
}
},
'AdministrativeAreaName' => 'CA'
},
'CountryNameCode' => 'US'
}
},
'address' => '548 4th St, San Francisco, CA 94107, USA',
'Point' => {
'coordinates' => [
'-122.397323',
'37.778993',
0
]
}
}
------------
my code is as follows:
...
my $geocoder = Geo::Coder::Google->new(apikey=>'my_key');
my $location=undef; $location=$geocoder->geocode(location=>"548 4th
St, San Francisco, CA 94107, USA");
while (my ($key,$value)=each(%$location)){
print "$key=>$value\n";
}
...
#unfortunately, I am unable to get past this part and can't find
anything w/in the module to help.
thx!
but my problem is accessing the values in the hash. How can I return
the coordinates (ie '-122.397323','37.778993',)?
#here is the hash (as posted on CSPAN page for Geo::Coder::Google)
##Link for a more legible version:
http://search.cpan.org/~miyagawa/Geo-Coder-Google-0.06/lib/Geo/Coder/Google.pm
{
'AddressDetails' => {
'Country' => {
'AdministrativeArea' => {
'SubAdministrativeArea' => {
'SubAdministrativeAreaName' => 'San Francisco',
'Locality' => {
'PostalCode' => {
'PostalCodeNumber' => '94107'
},
'LocalityName' => 'San Francisco',
'Thoroughfare' => {
'ThoroughfareName' => '548 4th St'
}
}
},
'AdministrativeAreaName' => 'CA'
},
'CountryNameCode' => 'US'
}
},
'address' => '548 4th St, San Francisco, CA 94107, USA',
'Point' => {
'coordinates' => [
'-122.397323',
'37.778993',
0
]
}
}
------------
my code is as follows:
...
my $geocoder = Geo::Coder::Google->new(apikey=>'my_key');
my $location=undef; $location=$geocoder->geocode(location=>"548 4th
St, San Francisco, CA 94107, USA");
while (my ($key,$value)=each(%$location)){
print "$key=>$value\n";
}
...
#unfortunately, I am unable to get past this part and can't find
anything w/in the module to help.
thx!