GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  GEO::CODER::OSM (3)

.ds Aq ’

NAME

Geo::Coder::OSM - Geocode addresses with the OpenStreetMap Nominatim API

CONTENTS

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 <B>uaB> parameter for passing in a custom LWP::UserAgent object.

Accepts an optional <B>sourcesB> parameter for specifying the data sources. Current valid values are <B>osmB> and <B>mapquestB>. The default value is <B>osmB>. To cycle between different sources, specify an array reference for the <B>sourcesB> 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 <B>B>%SOURCES<B>B> 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:
o GitHub Source Repository

<http://github.com/gray/geo-coder-osm>

o AnnoCPAN: Annotated CPAN documentation

<http://annocpan.org/dist/Geo-Coder-OSM>

o CPAN Ratings

<http://cpanratings.perl.org/d/Geo-Coder-OSM>

o RT: CPAN’s request tracker

<http://rt.cpan.org/Public/Dist/Display.html?Name=Geo-Coder-OSM>

o 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>
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 GEO::CODER::OSM (3) 2013-11-13

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.