Geo::Coder::Bing::Bulk - Geocode addresses in bulk with the Bing Spatial Data Services API
use Geo::Coder::Bing::Bulk; my $bulk = Geo::Coder::Bing::Bulk->new(key => 'Your Bing Maps key'); my $id = $bulk->upload(\@locations); sleep 30 while $bulk->is_pending; my $data = $bulk->download; my $failed = $bulk->failed;
The Geo::Coder::Bing::Bulk module provides an interface to the Bing Spatial Data Services API.
Geo::Coder::Bing::Bulk
$bulk = Geo::Coder::Bing->new('Your Bing Maps key') $bulk = Geo::Coder::Bing->new( key => 'Your Bing Maps key', id => 'Job ID', )
Creates a new bulk 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.
Accepts an optional id parameter from a previous call to "upload".
$id = $bulk->upload(\@locations)
Submits a single bulk query for all the given location strings and returns the assigned job id.
Note that query size is limited to 300 MB (uncompressed) and 200,000 locations; there is a limit of 10 concurrent bulk jobs and 50 jobs per 24 hours.
$bool = $bulk->is_pending
Polls for the job status and returns true if it has not yet completed.
$array_ref = $bulk->download
Downloads the results of the query and returns an array reference if there were results. A typical result looks like:
{ Address => { AddressLine => "W Sunset Blvd & Los Liones Dr", AdminDistrict => "CA", CountryRegion => "United States", FormattedAddress => "W Sunset Blvd & Los Liones Dr, Pacific Palisades, CA 90272", Locality => "Pacific Palisades", PostalCode => 90272, }, Confidence => "High", DisplayName => "W Sunset Blvd & Los Liones Dr, Pacific Palisades, CA 90272", EntityType => "RoadIntersection", Id => 0, InterpolatedLocation => { Latitude => "34.04185", Longitude => "-118.554" }, Query => "Sunset Blvd and Los Liones Dr, Pacific Palisades, CA", StatusCode => "Success", },
$array_ref = $bulk->failed
Returns an array reference if there were query failures.
Note that Bing will report invalid addresses as successfully geocoded even though it could not determine its location. Failures appear to only concern query construction- ex. missing fields, etc. So this is likely not going to affect users of this module- until advanced locations (hashrefs of fields) are permitted.
$response = $bulk->response()
Returns an HTTP::Response object for the last submitted request. Can be used to determine the details of an error.
$ua = $bulk->ua() $ua = $bulk->ua($ua)
Accessor for the UserAgent object.
http://msdn.microsoft.com/en-us/library/ff701734.aspx
Geo::Coder::Bing
Please report any bugs or feature requests to http://rt.cpan.org/Public/Bug/Report.html?Queue=Geo-Coder-Bing-Bulk. 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::Bulk
You can also look for information at:
GitHub Source Repository
http://github.com/gray/geo-coder-bing-bulk
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Geo-Coder-Bing-Bulk
CPAN Ratings
http://cpanratings.perl.org/d/Geo-Coder-Bing-Bulk
RT: CPAN's request tracker
http://rt.cpan.org/Public/Dist/Display.html?Name=Geo-Coder-Bing-Bulk
Search CPAN
http://search.cpan.org/dist/Geo-Coder-Bing-Bulk/
Copyright (C) 2010-2011 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::Bulk, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::Coder::Bing::Bulk
CPAN shell
perl -MCPAN -e shell install Geo::Coder::Bing::Bulk
For more information on module installation, please visit the detailed CPAN module installation guide.