aepyornis / nyc-geocoder-api

Simple Geocoder for New York City

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nyc-geocoder-api

A simple geocoder for NYC. Similar to the NYC's official geoclient api, but with far fewer bells and whistles.

All the heavy lifting is done by:

How to use

There's only one endpoint with 3 ways to submit an address:

  1. House, Street, and Borough
curl https://geocode.nycdb.info/?house=1000&street=surf avenue&borough=brooklyn
  1. House, Street, and Zipcode
curl https://geocode.nycdb.info/?house=1000&street=surf avenue&zipcode=11224
  1. Address
curl https://geocode.nycdb.info/?address=1000 Surf Avenue Brooklyn, NY 11224

All of those requests return the same json object:

{
  "bbl": "3086960212",
  "latitude": 40.57436,
  "longitude": -73.978499,
  "status": "OK"
}

Response format

Successful responses contains a simple JSON object with 4 fields: bbl, latitude, longitude, status.

Responses with errors have one or two fields: status and message. If present, the message field will contain information that might help you figure out what went wrong.

Example error:

This request:

curl https://geocode.nycdb.info/?house=1000&street=Surf%20Avenue

Returns this error:

{
	"status":"ERROR",
	"message":"Missing parameter: zipcode or borough"
}

That's it! There's no authorization and no other information provided besides bbl, latitude and longitude.

Installation

NOTE: This has not tested on anything other Debian-based systems. As currently setup it almost certainly won't work on other OSs.

setup geosupport and libpostal

make setup libpostal

Install ruby gems:

bundle install

Setup geosupport paths

source libgeo-paths 

Run:

ruby app.rb

Run the tests:

rspec test.rb

About

Simple Geocoder for New York City

License:GNU General Public License v3.0


Languages

Language:Ruby 83.9%Language:Makefile 13.9%Language:Shell 2.2%