Geo::Coder::Mappy - Geocode addresses with the Mappy AJAX API
use Geo::Coder::Mappy; my $geocoder = Geo::Coder::Mappy->new( token => 'Your Mappy AJAX API token' ); my $location = $geocoder->geocode( location => '47 Rue de Charonne, 75011 Paris, France' );
The Geo::Coder::Mappy module provides an interface to the geocoding functionality of the Mappy AJAX API.
Geo::Coder::Mappy
$geocoder = Geo::Coder::Mappy->new('Your Mappy AJAX API token') $geocoder = Geo::Coder::Mappy->new( token => 'Your Mappy AJAX API token', https => 1, debug => 1, )
Creates a new geocoding object.
An API token can be obtained here: http://connect.mappy.com/en/product/add/free
Accepts an optional https parameter for securing network traffic.
Accepts an optional ua parameter for passing in a custom LWP::UserAgent object.
$location = $geocoder->geocode(location => $location) @locations = $geocoder->geocode(location => $location)
In scalar context, this method returns the first location result; and in list context it returns all location results.
Each location result is a hashref; a typical example looks like:
{ AddressDetails => { Country => { AdministrativeArea => { AdministrativeAreaName => "Ile-de-France", Locality => { LocalityName => "Paris", Thoroughfare => { PostalCode => { PostalCodeNumber => 75011 }, ThoroughfareName => "Rue de Charonne", ThoroughfareNumber => [ { Type => "Interpolated", value => 47 }, { Type => "Requested", value => 47 }, ], Type => 1, }, Type => 1, }, }, CountryName => "France", CountryNameCode => { Scheme => "ISO 3166-1 numeric", value => 250 }, }, xmlns => "urn:oasis:names:tc:ciq:xsdschema:xAL:2.0", }, ExtendedData => { "mappy:address" => "47, Rue de Charonne, 75011, Paris, Ile-de-France, France", "mappy:coordinates_system" => 4326, "mappy:geocode_level" => { "mappy:code" => 4, "mappy:label" => "Road element level geocoding" }, "mappy:global_score" => "100.000000", "mappy:LocalGeocodeLevel" => { "mappy:code" => 5, "mappy:label" => "Road element level geocoding" }, "mappy:OfficialTownCode" => 75056, "mappy:road_element_id" => "202500065742970", "mappy:road_element_percentage" => "50.00", "mappy:SubcountryIsoCode" => 11, "xmlns:mappy" => "http://schemas.mappy.com/loc/2.1", }, name => "47 Rue de Charonne 75011 Paris", Point => { coordinates => "2.377409,48.853351" }, }
$response = $geocoder->response()
Returns an HTTP::Response object for the last submitted request. Can be used to determine the details of an error.
$ua = $geocoder->ua() $ua = $geocoder->ua($ua)
Accessor for the UserAgent object.
http://connect.mappy.com/en/api/overview
Please report any bugs or feature requests to http://rt.cpan.org/Public/Bug/Report.html?Queue=Geo-Coder-Mappy. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Geo::Coder::Mappy
You can also look for information at:
GitHub Source Repository
http://github.com/gray/geo-coder-mappy
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Geo-Coder-Mappy
CPAN Ratings
http://cpanratings.perl.org/d/Geo-Coder-Mappy
RT: CPAN's request tracker
http://rt.cpan.org/Public/Dist/Display.html?Name=Geo-Coder-Mappy
Search CPAN
http://search.cpan.org/dist/Geo-Coder-Mappy/
Copyright (C) 2011 gray <gray at cpan.org>, all rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
gray, <gray at cpan.org>
To install Geo::Coder::Mappy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::Coder::Mappy
CPAN shell
perl -MCPAN -e shell install Geo::Coder::Mappy
For more information on module installation, please visit the detailed CPAN module installation guide.