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 = require('geocoder');// Geocodinggeocoder.geocode("Atlanta, GA", function ( err, data ) { // do something with data});// Reverse Geocodinggeocoder.reverseGeocode( 33.7489, -84.3789, function ( err, data ) { // do something with data});// Setting sensor to truegeocoder.reverseGeocode( 33.7489, -84.3789, function ( err, data ) { // do something with data}, { sensor: true });// Setting language to Germangeocoder.reverseGeocode( 33.7489, -84.3789, function ( err, data ) { // do something with data}, { language: 'de' });// Selecting another provider to do reverse geocoding// Currently only geonames and yahoo placefinder are supportedgeocoder.selectProvider("geonames",{"username":"demo"});// Output will be roughly in the same format as Google'sgeocoder.reverseGeocode( 33.7489, -84.3789, function ( err, data ) { // do something with data});// see http://developer.yahoo.com/geo/placefinder/guide/index.htmlgeocoder.selectProvider("yahoo",{"appid":"xxx"});// Output will be roughly in the same format as Google'sgeocoder.reverseGeocode( 33.7489, -84.3789, function ( err, data ) { // do something with data});
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