0.0.4 • Published 12 years ago

mongo-postal v0.0.4

Weekly downloads
135
License
-
Repository
github
Last release
12 years ago

mongo-postal

A node.js module that both creates a MongoDB collection of US postal codes and provides geo-spatial searching on them given a source zipcode and radius. Based on the Geonames database www.geonames.org which is licensed under a Creative Commons Attribution 3.0 License.

License

Copyright (c) 2012 Chris Bumgardner and Misha Bosin

This content is released under the MIT License here

Download Geonames Postal Codes for the US

http://download.geonames.org/export/zip/US.zip

Configuration

I recommend creating a copy of config.js called local.config.js and adding it to your .gitignore so your MongoDB configuration settings do not get persisted in git.

Loading Postal Codes into MongoDB from the Command-Line

Saves postal code documents in MongoDB using geospatial indexes.

Example (be sure to npm install the dependencies listed under "NPM Dependencies" first):

Querying Postal Codes by Source Zipcode and Radius

Command-Line

This test searches for the 10 closest postal objects within a 4 mile radius of zipcode 94133:

Node.js API

todo

NPM Dependencies

  • mongoskin
  • optimist (for test/load-geonames.js only)
  • csv (for test/load-geonames.js only)

NPM Usage