node package manager


Geo is a very basic, but simple and extendable, geocode library for Node.js. Currently it only supports Google's Geocode API (v3) - Geo Spatial features are coming out soon

Geo for Node.js

by Felipe Oliveira (

Geo is a very basic, but simple, geo library for Node.js using Google's Geocode API (V3) for Geocoding and GeoHash for GeoSpatial support.


	npm install geo

Usage - Geocode

	var geo = require('geo');
	var address = '885 6th Ave #15D New York, NY 10001';
	var sensor = false;
	geo.geocoder(, address, sensor, function(formattedAddress, latitude, longitude) {
		console.log("Formatted Address: " + formattedAddress);
		console.log("Latitude: " + latitude);
		console.log("Longitude: " + longitude);

Usage - GeoHash

	// First define a model instance
	var model = {'address': '885 6th #15D, New York, NY 10001', 'baths': '1', 'beds': '1'};

	// Define callback that gets the location (from a single field, multiple fields, whatever) from the model instance (model can be anything, DB class, JSON, array)
	var locationGetterCallback = function(model) { return model['address']; };

	// Define callback that will augment the model instance with geo information such as latitude, longitude and geohash
	var geoSetterCallback = function(model, latitude, longitude, hash, callback) { 
		console.log('Geo Hash: ' + hash); 
		model['latitude'] = latitude; 
		model['longitude'] = longitude; 
		model['geohash'] = hash; 
		callback( model ); 

	// Now let's see what happens with the model
	geo.geomodel(model, locationGetterCallback, geoSetterCallback, function(model) {
		console.log("Model: " + model['address'] + ', Geo: ' + model['geohash']);