Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Geo::Coder::OpenCage(3User Contributed Perl DocumentatiGeo::Coder::OpenCage(3)

NAME
       Geo::Coder::OpenCage - Geocode coordinates and addresses	with the
       OpenCage	Geocoder

VERSION
       version 0.27

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

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

DESCRIPTION
       This module provides an interface to the	OpenCage geocoding service.

       For full	details	of the API visit <https://opencagedata.com/api>.

       It is recommended you read the best practices for using the OpenCage
       geocoder	<https://opencagedata.com/api#bestpractices> before you	start.

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

       Get your	API key	from <https://opencagedata.com>

   ua
	   $ua = $geocoder->ua();
	   $ua = $geocoder->ua($ua);

       Accessor	for the	UserAgent object. By default HTTP::Tiny	is used.
       Useful if for example you want to specify that something	like
       LWP::UserAgent::Throttled for rate limiting. Even if a new UserAgent is
       specified the useragent string will be specified	as
       "Geo::Coder::OpenCage $version"

   geocode
       Takes a single named parameter 'location' and returns a result hashref.

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

       warns and returns undef if the query fails for some reason.

       If you will be doing forward geocoding, please see the OpenCage query
       formatting guidelines <https://github.com/OpenCageData/opencagedata-
       misc-docs/blob/master/query-formatting.md>

       The OpenCage Geocoder has a few optional	parameters:

       Supported Parameters
	please see the OpenCage	geocoder documentation
	<https://opencagedata.com/api>.	Most of	the various optional
	parameters <https://opencagedata.com/api#forward-opt> are supported.
	For example:

	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.

	limit
	  Limits the maximum number of results returned. Default is 10.

	countrycode
	  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	comma seperated	list of	2 character code as
	  defined by the ISO 3166-1 Alpha 2 standard.

       Not Supported
	jsonp
	  This module always parses the	response as a Perl data	structure, so
	  the jsonp option is never used.

       As a full example:

	   my $result =	$Geocoder->geocode(
	       location	=> "DhNDhoDh3/4Dh^2NDhoDh<degree>N NDh>>Dh,NDh<degree>,	Dh!Dh<degree>Dh1/2DhoN-DhDh<micro>NDh<micro>NDh+-NNDh^3, Dh Dh3/4NNDh,N",
	       language	=> "ru",
	       countrycode => "ru",
	   );

   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 method supports the	optional parameters in the same	way that
       geocode() does.

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

       For more	information see	perlunicode.

SEE ALSO
       This module was featured	in the 2016 Perl Advent	Calendar
       <http://perladvent.org/2016/2016-12-08.html>.

       Ed Freyfogle from the OpenCage team gave	an interview with Built	in
       Perl about how Perl is used at OpenCage
       <http://blog.builtinperl.com/post/opencage-data-geocoding-in-perl>.

AUTHOR
       Ed Freyfogle

COPYRIGHT AND LICENSE
       Copyright 2019 OpenCage GmbH <cpan@opencagedata.com>

       Please check out	all our	open source work over at
       <https://github.com/opencagedata> and our developer blog:
       <https://blog.opencagedata.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.

AUTHOR
       edf <edf@opencagedata.com>

COPYRIGHT AND LICENSE
       This software is	copyright (c) 2020 by OpenCage GmbH.

       This is free software; you can redistribute it and/or modify it under
       the same	terms as the Perl 5 programming	language system	itself.

perl v5.32.0			  2020-08-22	       Geo::Coder::OpenCage(3)

NAME | VERSION | SYNOPSIS | DESCRIPTION | METHODS | ENCODING | SEE ALSO | AUTHOR | COPYRIGHT AND LICENSE | AUTHOR | COPYRIGHT AND LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Geo::Coder::OpenCage&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help