-
-
14 Jun 2018 18:00:21 UTC
- Distribution: Geo-Coder-US-Census
- Module version: 0.05
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (0)
- Testers (731 / 0 / 13)
- Kwalitee
Bus factor: 1- 47.33% Coverage
- License: open_source
- Perl: v5.6.2
- Activity
24 month- Tools
- Download (15.92KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Encode
- Geo::StreetAddress::US
- HTTP::Request
- JSON
- LWP::Protocol::https
- LWP::UserAgent
- Net::SSLeay
- URI
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Geo::Coder::US::Census - Provides a Geo-Coding functionality for the US using https://geocoding.geo.census.gov
VERSION
Version 0.05
SYNOPSIS
use Geo::Coder::US::Census; my $geo_coder = Geo::Coder::US::Census->new(); my $location = $geo_coder->geocode(location => '4600 Silver Hill Rd., Suitland, MD'); # Sometimes the server gives a 500 error on this $location = $geo_coder->geocode(location => '4600 Silver Hill Rd., Suitland, MD, USA');
DESCRIPTION
Geo::Coder::US::Census provides an interface to geocoding.geo.census.gov. Geo::Coder::US no longer seems to work.
METHODS
new
$geo_coder = Geo::Coder::US::Census->new(); my $ua = LWP::UserAgent->new(); $ua->env_proxy(1); $geo_coder = Geo::Coder::US::Census->new(ua => $ua);
geocode
$location = $geo_coder->geocode(location => $location); # @location = $geo_coder->geocode(location => $location); print 'Latitude: ', $location->{'latt'}, "\n"; print 'Longitude: ', $location->{'longt'}, "\n";
ua
Accessor method to get and set UserAgent object used internally. You can call env_proxy for example, to get the proxy information from environment variables:
$geo_coder->ua()->env_proxy(1);
You can also set your own User-Agent object:
$geo_coder->ua(LWP::UserAgent::Throttled->new());
reverse_geocode
# $location = $geo_coder->reverse_geocode(latlng => '37.778907,-122.39732');
# Similar to geocode except it expects a latitude/longitude parameter.
Not supported.
run
You can also run this module from the command line:
perl Census.pm 1600 Pennsylvania Avenue NW, Washington DC
AUTHOR
Nigel Horne <njh@bandsman.co.uk>
Based on Geo::Coder::GooglePlaces.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Lots of thanks to the folks at geocoding.geo.census.gov.
BUGS
Should be called Geo::Coder::NA for North America.
SEE ALSO
Geo::Coder::GooglePlaces, HTML::GoogleMaps::V3
https://www.census.gov/data/developers/data-sets/Geocoding-services.html
LICENSE AND COPYRIGHT
Copyright 2017,2018 Nigel Horne.
This program is released under the following licence: GPL2
Module Install Instructions
To install Geo::Coder::US::Census, copy and paste the appropriate command in to your terminal.
cpanm Geo::Coder::US::Census
perl -MCPAN -e shell install Geo::Coder::US::Census
For more information on module installation, please visit the detailed CPAN module installation guide.