Skip to content

wallali/geocoder.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

geocoder.js

Fast offline coarse Geocoder based on GeoNames data.

Usage

var geocoder = require('geocoder.js');

geocoder('Big Apple', function (location) {
	/*
	{
		id: '5128581',
		name: 'New York City',
		country: 'US',
		latitude: '40.71427',
		longitude: '-74.00597',
		alternate: '0',
		population: '8175133'
	}
	*/

	console.log(location);
});

Install

npm install geocoder.js

Build Database

wget -q http://download.geonames.org/export/dump/countryInfo.txt -O ./node_modules/geocoder.js/data/geonames/countryInfo.txt && \
wget -q http://download.geonames.org/export/dump/cities1000.zip -O ./node_modules/geocoder.js/data/geonames/cities1000.zip && \
wget -q http://download.geonames.org/export/dump/alternateNames.zip -O ./node_modules/geocoder.js/data/geonames/alternateNames.zip && \
unzip ./node_modules/geocoder.js/data/geonames/cities1000.zip -d ./node_modules/geocoder.js/data/geonames/ && \
unzip ./node_modules/geocoder.js/data/geonames/alternateNames.zip -d ./node_modules/geocoder.js/data/geonames/ && \
rm ./node_modules/geocoder.js/data/geonames/*.zip && \
node ./node_modules/geocoder.js/data/build.js

License

MIT

About

Fast offline coarse Geocoder based on GeoNames data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%