Geo::Coder::GoogleMaps::Location - Geo::Coder::GoogleMaps' Location object
Version 0.3 (follow Geo::Coder::Google version number)
Here we have the object returned by Geo::Coder::GoogleMaps::Response->placemarks().
This object can generate and manipulate the geocoding subset of KML 2.2 object (main change for the geocoding feature is the introduction of ExtendedData).
The constructor can take the following arguments :
- SubAdministrativeAreaName : a string - PostalCodeNumber : a postal code (err...) - LocalityName : yes! A locality name ! - ThoroughfareName: same thing => a string - AdministrativeAreaName - CountryName - CountryNameCode - address - longitude - latitude - altitude (warning in Google Map API altitude must be 0)
Access the SubAdministrativeAreaName parameter.
print $location->SubAdministrativeAreaName(); # retrieve the value $location->SubAdministrativeAreaName("Paris"); # set the value
Access the PostalCodeNumber parameter.
print $location->PostalCodeNumber(); # retrieve the value $location->PostalCodeNumber("75000"); # set the value
Access the ThoroughfareName parameter.
print $location->ThoroughfareName(); # retrieve the value $location->ThoroughfareName("1 Avenue des Champs Élysées"); # set the value
Access the LocalityName parameter.
print $location->LocalityName(); # retrieve the value $location->LocalityName("Paris"); # set the value
Access the AdministrativeAreaName parameter.
print $location->AdministrativeAreaName(); # retrieve the value $location->AdministrativeAreaName("PA"); # set the value
Access the CountryName parameter.
print $location->CountryName(); # retrieve the value $location->CountryName("France"); # set the value
Access the CountryNameCode parameter.
print $location->CountryNameCode(); # retrieve the value $location->CountryNameCode("FR"); # set the value
Access the Accuracy parameter.
print $location->Accuracy(); # retrieve the value $location->Accuracy(8); # set the value
Access the address parameter.
print $location->address(); # retrieve the value $location->address("1 Avenue des Champs Élysées, 75000, Paris, FR"); # set the value
Access the id parameter.
print $location->id(); # retrieve the value $location->id("point1"); # set the value
Access the latitude parameter.
print $location->latitude(); # retrieve the value $location->latitude("-122.4558"); # set the value
Access the longitude parameter.
print $location->longitude(); # retrieve the value $location->longitude("55.23465"); # set the value
Access the altitude parameter.
print $location->altitude(); # retrieve the value $location->altitude(0); # set the value
Please note that it must be 0 if you use the Google Map API.
This method is not really an accessor, it's only a getter which return longitude, latitude and altitude as a string.
print "Placemark's coordinates: ",$location->coordinates,"\n";
Access the north parameter from the LatLonBox.
print $location->LLB_north(); # retrieve the value $location->LLB_north(48.9157461); # set the value
Access the south parameter from the LatLonBox.
print $location->LLB_south(); # retrieve the value $location->LLB_south(48.9157461); # set the value
Access the east parameter from the LatLonBox.
print $location->LLB_east(); # retrieve the value $location->LLB_east(48.9157461); # set the value
Access the west parameter from the LatLonBox.
print $location->LLB_west(); # retrieve the value $location->LLB_west(48.9157461); # set the value
Return a JSON encoded object ( thanks to JSON::Syck::Dump() )
my $json = $location->toJSON ;
Return a KML object ( thanks to XML::LibXML ).
my $kml = $location->toXML ;
Please note that this function can take an optionnal argument (0 or 1) and if it's set to 1 this method return a XML string instead of the XML::LibXML::Document object.
An allias for toKML()
This method simply call the good to(JSON|XML|KML) depending of the output format you selected.
You can eventually pass extra arguments, they will be relayed.
$location->Serialyze(1); # if the output is set to XML or KML you will have a stringified XML as output
Arnaud Dupuis, <a.dupuis at infinityperl.org>
<a.dupuis at infinityperl.org>
Please report any bugs or feature requests to bug-geo-coder-googlemaps at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Geo-Coder-GoogleMaps. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-geo-coder-googlemaps at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Geo::Coder::GoogleMaps
You can also look for information at:
Infinity Perl:
http://www.infinityperl.org
Google Code repository
https://code.google.com/p/geo-coder-googlemaps/
Google Maps API documentation
http://code.google.com/apis/maps/documentation/geocoding/
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Geo-Coder-GoogleMaps
CPAN Ratings
http://cpanratings.perl.org/d/Geo-Coder-GoogleMaps
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Geo-Coder-GoogleMaps
Search CPAN
http://search.cpan.org/dist/Geo-Coder-GoogleMaps
Copyright 2007 Arnaud DUPUIS and Nabla Development, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Geo::Coder::GoogleMaps, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::Coder::GoogleMaps
CPAN shell
perl -MCPAN -e shell install Geo::Coder::GoogleMaps
For more information on module installation, please visit the detailed CPAN module installation guide.