Provided by: libgeo-coder-osm-perl_0.03-4_all
NAME
Geo::Coder::OSM - Geocode addresses with the OpenStreetMap Nominatim API
SYNOPSIS
use Geo::Coder::OSM; my $geocoder = Geo::Coder::OSM->new; my $location = $geocoder->geocode( location => 'Hollywood and Highland, Los Angeles, CA' );
DESCRIPTION
The "Geo::Coder::OSM" module provides an interface to the OpenStreet Nominatim geocoding service.
METHODS
new $geocoder = Geo::Coder::OSM->new() $geocoder = Geo::Coder::OSM->new( ua => $ua, sources => [ 'osm', 'mapquest' ], debug => 1, ) Creates a new geocoding object. Accepts an optional ua parameter for passing in a custom LWP::UserAgent object. Accepts an optional sources parameter for specifying the data sources. Current valid values are osm and mapquest. The default value is osm. To cycle between different sources, specify an array reference for the sources value. To define additional sources, see "SOURCES" below. geocode $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: { address => { city => "Los Angeles", country => "United States of America", country_code => "us", hamlet => "Hollywood", road => "Hollywood Boulevard", station => "Hollywood/Highland", suburb => "Little Armenia", }, boundingbox => [ "34.101634979248", "34.1018371582031", "-118.339317321777", "-118.33910369873", ], class => "railway", display_name => "Hollywood/Highland, Hollywood Boulevard, Little Armenia, Hollywood, Los Angeles, United States of America", icon => "http://nominatim.openstreetmap.org/images/mapicons/transport_train_station2.p.20.png", lat => "34.101736", licence => "Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.", lon => "-118.33921", osm_id => 472413621, osm_type => "node", place_id => 9071654, type => "station", } reverse_geocode $location = $geocoder->reverse_geocode(lat => $lat, lon => $lon) $location = $geocoder->reverse_geocode(latlng => "$lat,$lon") Returns a location result for the given lat/lon pair. response $response = $geocoder->response() Returns an HTTP::Response object for the last submitted request. Can be used to determine the details of an error. ua $ua = $geocoder->ua() $ua = $geocoder->ua($ua) Accessor for the UserAgent object. SOURCES To define additional sources add them to the %SOURCES package variable like so: $Geo::Coder::OSM::SOURCES{local} = 'http://127.0.0.1/api_base_path'; $Geo::Coder::OSM::SOURCES{internal} = 'http://internal.corp/api_base_path';
SEE ALSO
<http://wiki.openstreetmap.org/wiki/Nominatim> <http://open.mapquestapi.com/nominatim/>
REQUESTS AND BUGS
Please report any bugs or feature requests to <http://rt.cpan.org/Public/Bug/Report.html?Queue=Geo-Coder-OSM>. 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::OSM You can also look for information at: • GitHub Source Repository <http://github.com/gray/geo-coder-osm> • AnnoCPAN: Annotated CPAN documentation <http://annocpan.org/dist/Geo-Coder-OSM> • CPAN Ratings <http://cpanratings.perl.org/d/Geo-Coder-OSM> • RT: CPAN's request tracker <http://rt.cpan.org/Public/Dist/Display.html?Name=Geo-Coder-OSM> • Search CPAN <http://search.cpan.org/dist/Geo-Coder-OSM/>
COPYRIGHT AND LICENSE
Copyright (C) 2010-2013 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.
AUTHOR
gray, <gray at cpan.org>