Geo::Coder::Many::Util
Miscellaneous routines that are convenient for, for example, generating commonly used callback methods to be used with Geo::Coder::Many.
Constructs a result filter callback which only passes results which exceed the specified precision.
Constructs a result filter callback which only passes results with the specified 'country' value.
A picker callback that requests all available results, and then picks the one with the highest precision. Note that querying all available geocoders may take a comparatively long time.
Example:
$GCMU->set_picker_callback( \&max_precision_picker );
Returns a picker callback that requires at least 'required_consensus' separate geocoder results to be within a bounding square of side-length 'nearness'. If this can be satisfied, the result from that square which has the highest precision will be returned. Otherwise, asks for more/returns undef.
WARNING: quadratic time in length of @$ra_results - could be improved if necessary.
$GCMU->set_picker_callback( consensus_picker({nearness => 0.1, required_consensus => 2}) );
my $precision = Geo::Coder::Many::Util->determine_precision_from_bbox({ 'lon1' => $sw_lon, 'lat1' => $sw_lat, 'lon2' => $ne_lon, 'lat2' => $ne_lat, });
returns a precison between 0 (unknown) and 1 (highly precise) based on the size of the box supplied
Used by consensus_picker - returns true if ($lat, $lon) is inside the square with centre ($centre_lat, $centre_lon) and side length 2*$half_width.
Given a reference to an array of result hashes, returns the one with the highest precision value
To install Geo::Coder::Many, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::Coder::Many
CPAN shell
perl -MCPAN -e shell install Geo::Coder::Many
For more information on module installation, please visit the detailed CPAN module installation guide.