convert latitude longitude coordinate pairs to US zip codes
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test
.gitignore fixed unit tests, version bump for new zip codes Feb 16, 2016
.npmignore
LICENSE switched to MIT license Nov 23, 2014
index.js switch from kdtree library to kdt because it will work with browserify Nov 28, 2014
package.json fixed unit tests, version bump for new zip codes Feb 16, 2016
readme.md fixed unit tests, version bump for new zip codes Feb 16, 2016
sort.js
zip_codes_sorted.json Updating ZipCode & LatLan Mapping according to 2015 data. Source: htt… Feb 16, 2016

readme.md

Gps2zip

Convert GPS latitude longitude pairs to a US zip code.

Quick Start

npm install gps2zip

Usage

var gps = require('gps2zip'); var latitude = 30.2669; var longitude = 97.7428; gps.gps2zip(latitude, longitude); // returns 78701

Unit tests

node test/basic.js

Accuracy

The output is approximate. The source data is just a list of coordinates, not actual boundaries. The algorithm just finds the minimum euclidean distance between the point in question and the known points. No error checking for points outside the United States.

Related

You can get full street addresses using the Google Maps Reverse Geocoding API: http://code.google.com/apis/maps/documentation/javascript/geocoding.html#ReverseGeocoding

Credit

Zip codes from The Zip Code Database Project http://sourceforge.net/projects/zips/