Geocoder
Installation:
npm install geocoder
Usage
You can pass a string representation of a location and a callback function to geocoder.geocode
. It will accept anything that Google will accept: cities, streets, countries, etc.
Example:
var geocoder = ; // Geocodinggeocoder; // Reverse Geocodinggeocoder; // Setting sensor to truegeocoder; // Setting language to Germangeocoder; // Selecting another provider to do reverse geocoding// Currently only geonames and yahoo placefinder are supportedgeocoder; // Output will be roughly in the same format as Google'sgeocoder; // see http://developer.yahoo.com/geo/placefinder/guide/index.htmlgeocoder; // Output will be roughly in the same format as Google'sgeocoder;
Results will look like standard Google JSON Output
You can pass in an optional options hash as a last argument, useful for setting sensor to true (it defaults to false) and the language (default is empty which means that google geocoder will guess it by geo ip data). For details see the Google Geocoding API Docs
Testing:
nodeunit test
Roadmap
- Complete Test Suite
- Better options handling