Technical Overview: Geocoder.US

Geocoder.US is a popular online geocoding service. The service supports geocoding through REST, XML-RPC, SOAP, web interface, and email. Limited services are free for non-commercial purposes. Batch geocoding is also available for commercial users.

 

The various Geocoder.us services can be found at Geocoder.us and the Geocoder.net synonym. Geocoder supports a mix of commercial and non-commercial geocoding services using a range of different protocols. The range of protocols and free non-commercial services make it a popular choice for geospatial mashups and book examples.

The underlying geocoder is based on the public domain TIGER/Line data from the US Census Bureau, and it is currently using the 2004 version. TIGER/Line data updates are infrequent and data quality is variable. Urban locations are often within 10m (ie. better than many consumer GPS devices), but sometimes errors can be much larger.

Coordinate results use the NAD83 datum for the 48 contiguous states, Alaska, Puerto Rico, and the US Virgin Islands. Regional datums are used for Hawai’i and the Pacific Island areas. Geocoder.us only supports the US and its territories.

The geocoding algorithm is based on the open source Geo::Coder::US Perl module, which has been made available through CPAN. Therefore you are free to use this module to implement your own local geocoder if you have access to appropriate data for your region, or a better source of US data.

Geocoder.us has a simple demonstration website that can be used to geocode individual addresses through a web interface. The web services are much more useful. These support SOAP, XML-RPC, and REST. Examples in the documentation include PHP, PERL, C#, and ASP. Anyone with some experience of web services in their language of choice should have no problems adapting these examples to their own language.

RESTful services are definitely in vogue, and modern developers probably prefer to use a simple RESTful service rather than the more complicated SOAP approach. Geocoder.us supports two RESTful services: RDF and CSV. The following example, taken from the documentation, is a simple PERL fragment that uses the commercial RDF service and parses the response:

    use RDF::Simple::Parser;
    use URI::Escape;
    use Data::Dumper;

    my $addr = uri_escape( "1600 Pennsylvania Ave, Washington, DC" );

    my @result = RDF::Simple::Parser
	->new
	->parse_uri( "http://username:password\@geocoder.us/member/service/rest/geocode"
	    . "?address=$addr" );

    print Dumper \@result;

Here is the parsed response:

@result = (
          [
            '_:id4280ab4aa61e',
            'http://www.w3.org/1999/02/22-rdf-syntax-ns#type',
            'http://www.w3.org/2003/01/geo/wgs84_pos#Point'
          ],
          [
            '_:id4280ab4aa61e',
            'http://purl.org/dc/elements/1.1/description',
            '1600 Pennsylvania Ave NW, Washington DC 20502'
          ],
          [
            '_:id4280ab4aa61e',
            'http://www.w3.org/2003/01/geo/wgs84_pos#long',
            '-77.037684'
          ],
          [
            '_:id4280ab4aa61e',
            'http://www.w3.org/2003/01/geo/wgs84_pos#lat',
            '38.898748'
          ]
        );

The CSV option returns simple comma separated value text. This is probably easier to parse for many applications.

Although Geocoder.us is free for non-commercial applications, there are fees for commercial applications and batch geocoding. Compared to competing commercial services, these are very cheap: US$50 per 20,000 address (US$50 minimum, pro rata after that). This is paid in advance to enable the commercial variant of the web services; or batches can be sent by email. Email batches should use CSV or Excel files, although Geocoder.us can support other formats with additional fees.

So, in summary, Geocoder.US is a very useful online geocoding service. Accuracy and data completeness can be a problem, but competing systems cost substantially more for commercial applications.

Leave a Reply