NAME
Geo::Parser::Text - Perl extension for parsing and geocoding locations from free form text. (See Geocode.xyz or Geolytica.com or addrs.xyz for coverage details)
VERSION
Version 0.03
SYNOPSIS
use Geo::Parser::Text;
# initialize with your host
my $g = Geo::Parser::Text->new([geo_host]);
# Scan text for locations...
$g->scantext($text);
# Geocode a single location...
$g->locate($string);
#
if ($g->geocode) {
my $hashref = $g->geocode;
}
# Example...
use Geo::Parser::Text;
use Data::Dumper;
my $g = Geo::Parser::Text->new('http://geocode.xyz');
$g->scantext('The most important museums of Amsterdam are located on the Museumplein, located at the southwestern side of the Rijksmuseum.');
print Dumper $g->geocode;
#or
$g->locate('10 Downing St, London SW1A 2AA, United Kingdom');
print Dumper $g->geocode;
DESCRIPTION
This module provides a Perl frontend for the geocode.xyz API. It allows the programmer to extract locations containing street addresses, street intersections and city names along with their geocoded latitude,longitude from bodies of text such as microblogs or wikipedia entries. (It should work with any type of text, but dumping html text or paragraphs containing over 200 words, will slow down the response considerably. If you need faster parsing grab the geocode.xyz server image on the AWS, and run it on a faster server (it is currenly running on a micro instance and is shared as a free public API without any throttling or rate limiting in place.) If you run your own instance, make sure to pass the instance ip address or domain name at invocation eg, Geo::Parser::Text->new($server). For North American locations use geolytica.com, and for Australia and New Zealand use addrs.xyz
The api also geocodes single locations (returning the location matched with the highest probability from a string of text. If you pass a latitude,longitude pair, it will reverse geocode that point)
For explanation on the API responses see http://geocode.xyz/api
METHODS
new ( host => 'geocode.xyz');
Initialize with the default server. geocode.xyz for Europe, geocoder.ca for North America, addrs.xyz for Australia and New Zealand.
- scantext($text)
-
Set the text to be scanned.
- locate($string)
-
Set the string to be geocoded. ($string may contain an address, city name, post code, for forward geocoding; or latitude,longitude pair for reverse geocoding)
- geocode()
-
Send the text/string to geocode.xyz and return the hash reference with the response. You are required to set either the scantext or locate method before calling geocode().
EXPORT
None by default.
REQUIREMENTS
XML::Simple, LWP::UserAgent, HTTP::Request, URI
AUTHOR
Ervin Ruci, <eruci at geocoder.ca>
BUGS
Please report any bugs or feature requests to bug-geo-parser-text at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Geo-Parser-Text. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Geo::Parser::Text
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2016 Ervin Ruci.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:
http://www.perlfoundation.org/artistic_license_2_0
Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.
If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.
This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.
This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SEE ALSO
Geo::Coder::Canada Geo::Parse::OSM Text::NLP
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 167:
'=item' outside of any '=over'
- Around line 181:
You forgot a '=back' before '=head1'