NAME

Geo::Coder::GoogleMaps::Location - Geo::Coder::GoogleMaps' Location object

VERSION

Version 0.4 (follow Geo::Coder::GoogleMaps version number)

SYNOPSIS

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).

FUNCTIONS

new

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 Maps API altitude must be 0)

SubAdministrativeAreaName

Access the SubAdministrativeAreaName parameter.

print $location->SubAdministrativeAreaName(); # retrieve the value
$location->SubAdministrativeAreaName("Paris"); # set the value

PostalCodeNumber

Access the PostalCodeNumber parameter.

print $location->PostalCodeNumber(); # retrieve the value
$location->PostalCodeNumber("75000"); # set the value

ThoroughfareName

Access the ThoroughfareName parameter.

print $location->ThoroughfareName(); # retrieve the value
$location->ThoroughfareName("1 Avenue des Champs Élysées"); # set the value

LocalityName

Access the LocalityName parameter.

print $location->LocalityName(); # retrieve the value
$location->LocalityName("Paris"); # set the value

AdministrativeAreaName

Access the AdministrativeAreaName parameter.

print $location->AdministrativeAreaName(); # retrieve the value
$location->AdministrativeAreaName("PA"); # set the value

CountryName

Access the CountryName parameter.

print $location->CountryName(); # retrieve the value
$location->CountryName("France"); # set the value

CountryNameCode

Access the CountryNameCode parameter.

print $location->CountryNameCode(); # retrieve the value
$location->CountryNameCode("FR"); # set the value

Accuracy

Access the Accuracy parameter.

print $location->Accuracy(); # retrieve the value
$location->Accuracy(8); # set the value

address

Access the address parameter.

print $location->address(); # retrieve the value
$location->address("1 Avenue des Champs Élysées, 75000, Paris, FR"); # set the value

id

Access the id parameter.

print $location->id(); # retrieve the value
$location->id("point1"); # set the value

latitude

Access the latitude parameter.

print $location->latitude(); # retrieve the value
$location->latitude("-122.4558"); # set the value

longitude

Access the longitude parameter.

print $location->longitude(); # retrieve the value
$location->longitude("55.23465"); # set the value

altitude

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.

coordinates

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";

LLB_north

Access the north parameter from the LatLonBox.

print $location->LLB_north(); # retrieve the value
$location->LLB_north(48.9157461); # set the value

LLB_south

Access the south parameter from the LatLonBox.

print $location->LLB_south(); # retrieve the value
$location->LLB_south(48.9157461); # set the value

LLB_east

Access the east parameter from the LatLonBox.

print $location->LLB_east(); # retrieve the value
$location->LLB_east(48.9157461); # set the value

LLB_west

Access the west parameter from the LatLonBox.

print $location->LLB_west(); # retrieve the value
$location->LLB_west(48.9157461); # set the value

toJSON

Return a JSON encoded object ( thanks to JSON::Syck::Dump() )

my $json = $location->toJSON ;

toKML

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.

toXML

An allias for toKML()

Serialize

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->Serialize(1); # if the output is set to XML or KML you will have a stringified XML as output

Serialyze (OBSOLETE)

This method is just an alias to Serialize(), it is kept for backward compatibility only.

Please use the Serialize() method, this one is meant to be removed.

AUTHOR

Arnaud Dupuis, <a.dupuis at infinityperl.org>

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Geo::Coder::GoogleMaps::Location

You can also look for information at:

ACKNOWLEDGEMENTS

Slaven Rezic (SREZIC) for all the patches and his useful reports on RT.

COPYRIGHT & LICENSE

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.