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::OPENCAGE (3)

.ds Aq ’

NAME

Geo::Coder::OpenCage - Geocode addresses with the OpenCage Geocoder API

CONTENTS

VERSION

version 0.05

DESCRIPTION

This module provides an interface to the OpenCage geocoding service.

For full details on the API visit <http://geocoder.opencagedata.com/api.html>.

SYNOPSIS



    my $Geocoder = Geo::Coder::OpenCage->new(api_key => $my_api_key);

    my $result = $Geocoder->geocode(location => "Donostia");



METHODS

    new



    my $Geocoder = Geo::Coder::OpenCage->new(api_key => $my_api_key);



You can get your API key from http://geocoder.opencagedata.com

    geocode

Takes a single named parameter ’location’ and returns a result hashref.



    my $result = $Geocoder->geocode(location => "Mudgee, Australia");



The OpenCage Geocoder has a few optional parameters, some of which this module supports and some of which it doesn’t.
Supported Parameters
language An IETF format language code (such as es for Spanish or pt-BR for Brazilian Portuguese); if this is omitted a code of en (English) will be assumed.
country Provides the geocoder with a hint to the country that the query resides in. This value will help the geocoder but will not restrict the possible results to the supplied country.

The country code is a 3 character code as defined by the ISO 3166-1 Alpha 3 standard.

Not Supported
format This module only ever uses the JSON format. For other formats you should access the API directly using HTTP::Tiny or similar user agent module.
jsonp This module always parses the response as a Perl data structure, so the jsonp option is never used.
fields This module always grabs all of the data, and never uses the fields option.
As a full example:



    my $result = $Geocoder->geocode(
        location => "XXXXXXXXX XXXXX, XXXXX-XXXXXXXXX, XXXXXX",
        language => "ru",
        country => "rus",
    );



    reverse_geocode

Takes two named parameters ’lat’ and ’lng’ and returns a result hashref.



    my $result = $Geocoder->reverse_geocode(lat => -22.6792, lng => 14.5272);



This supports the optional ’language’ parameter in the same way that geocode() does.

ENCODING

All strings passed to and recieved from Geo::Coder::OpenCage methods are expected to be character strings, not byte strings.

For more information see perlunicode.

AUTHOR

Alex Balhatchet, alex@lokku.com

COPYRIGHT AND LICENSE

Copyright 2014 Lokku Ltd <cpan@lokku.com>

Please check out all our open source work over at https://github.com/lokku and our developer blog: http://devblog.nestoria.com

Thanks!

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.16 or, at your option, any later version of Perl 5 you may have available.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 GEO::CODER::OPENCAGE (3) 2014-06-20

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