Geo::Coder::Bing - Geocode addresses with the Bing Maps API
use Geo::Coder::Bing; my $geocoder = Geo::Coder::Bing->new(key => 'Your Bing Maps key'); my $location = $geocoder->geocode( location => 'Hollywood and Highland, Los Angeles, CA' );
The Geo::Coder::Bing module provides an interface to the Bing Maps geocoding service.
Geo::Coder::Bing
$geocoder = Geo::Coder::Bing->new('Your Bing Maps key') $geocoder = Geo::Coder::Bing->new( key => 'Your Bing Maps key', # https => 1, # debug => 1, )
Creates a new geocoding object.
A Bing Maps key can be obtained here: http://msdn.microsoft.com/en-us/library/ff428642.aspx.
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.
Any additional arguments will added to the request parameters. See the Bing Maps documention for the list of available parameters. An example:
@locations = $geocoder->geocode( location => $location, includeNeighborhood => 1, maxResults => 20, )
Each location result is a hashref; a typical example looks like:
{ __type => "Location:http://schemas.microsoft.com/search/local/ws/rest/v1", address => { addressLine => "Hollywood Blvd & N Highland Ave", adminDistrict => "CA", countryRegion => "United States", formattedAddress => "Hollywood Blvd & N Highland Ave, Los Angeles, CA 90028", locality => "Los Angeles", postalCode => 90028, }, bbox => [ "34.0977008647939", "-118.344888641665", "34.1054262999352", "-118.332449571785", ], confidence => "High", entityType => "RoadIntersection", name => "Hollywood Blvd & N Highland Ave, Los Angeles, CA 90028", point => { coordinates => [ "34.1015635823646", "-118.338669106725" ], type => "Point", }, }
$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 = $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.
Starting with version 0.08, this module uses the REST API instead of the AJAX API. Backwards compatibility has been maintained, but its usage by this module is now deprecated, hence a warning is issued when a key is not provided to the constructor. Also note that the structure of the data returned from both APIs differs slightly.
http://msdn.microsoft.com/en-us/library/ff701711.aspx
Geo::Coder::Bing::Bulk
Please report any bugs or feature requests to http://rt.cpan.org/Public/Bug/Report.html?Queue=Geo-Coder-Bing. 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::Bing
You can also look for information at:
GitHub Source Repository
http://github.com/gray/geo-coder-bing
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Geo-Coder-Bing
CPAN Ratings
http://cpanratings.perl.org/d/Geo-Coder-Bing
RT: CPAN's request tracker
http://rt.cpan.org/Public/Dist/Display.html?Name=Geo-Coder-Bing
Search CPAN
http://search.cpan.org/dist/Geo-Coder-Bing/
Copyright (C) 2009-2015 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::Bing, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::Coder::Bing
CPAN shell
perl -MCPAN -e shell install Geo::Coder::Bing
For more information on module installation, please visit the detailed CPAN module installation guide.