city-reverse-geocoder

A simple, fast, database-less city reverse geocoder for Node.js

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
city-reverse-geocoder
1020.0.19 years ago9 years agoMinified + gzip package size for city-reverse-geocoder in KB

Readme

node-city-reverse-geocoder
A simple, fast, database-less reverse geocoder for Node.js

Install

npm install city-reverse-geocoder

Usage

An example of using the tree:
var crg = require('city-reverse-geocoder');

// Return the nearest city to (48.8567, 2.3508) in kilometers
console.log(crg(48.8567, 2.3508));

// Return the nearest city to (48.8567, 2.3508) in miles
console.log(crg(48.8567, 2.3508, 1, 'mi'));

// Return the top 3 nearest cities to (48.8567, 2.3508) in kilometers
console.log(crg(48.8567, 2.3508, 3 /*, 'km' (default) */));

// Return the top 3 nearest cities to (48.8567, 2.3508) in miles
console.log(crg(48.8567, 2.3508, 3, 'mi'));