Skip to content
bibanul edited this page Nov 27, 2014 · 2 revisions

TIGER Geocoder REST API Guide

This guide will explain the methods available when using the REST JSON interface available with the EC2 AMI Instance.

Overview

We have developed a Node.js API that wraps up the geocoding calls to Postgres and also uses a Redis cache to avoid hitting Postgres for queries that were previously resolved. The REST API is available on root of your Amazon server instance DNS and runs on default port 80. The following methods are available:

/geocode/{address}

This method will accept an address as string and will attempt to geocode and return the best result.

Example (Note that the address must be URL Encoded):

http://myec2server.amazonaws.com/geocode/1600%20pennsylvania%20avenue,Washington,DC

{"result": {
  "accuracy":5,
  "formatted_address":"1600 Pennsylvania Ave NW, Washington, DC 20502",
  "location":{
      "lat":38.8986709360362,
      "lon":-77.0351147858455
  },
  "streetNumber":1600,
    "street":"Pennsylvania",
    "streetType":"Ave",
    "city":"Washington",
    "state":"DC",
    "zipcode":"20502",
    "cityId":"1150000",
    "stateId":"11",
    "neighborhoodId":"1556",
    "neighborhood":"Downtown",
    "tractId":"11001006202",
    "tract":"62.02",
    "countyId":"11001",
    "county":"District of Columbia"
    }
}

/revgeocode/{lat},{lon}

This method will accept two parameters, lat and long and will return the closest address.

Example:

http://myec2server.amazonaws.com/revgeocode/38.8986709360362,-77.0351147858455

{"result":{
  "formatted_address":"692 E Executive Ave, Washington, DC 20006",
  "location":{
    "lat":38.8986709360362, 
    "lon":-77.0351147858455
  },
  "streetNumber":692,
    "street":"Executive",
    "city":"Washington",
    "zipcode":"20006"
}}