Wednesday, 15 May 2013

javascript - NodeJS find country by Lat/Lon -



javascript - NodeJS find country by Lat/Lon -

i have nodejs server , multiply databases, 1 each country. want able select right country coordinates (lat/lon) user sends parameter. (e.g myserver/query/lat/lon) couldn't find nodejs bundle that. did found ones filter country based on ip address that's not case here. thanks.

here bundle that: https://github.com/vkurchatkin/which-country

the api quite simple:

var wc = require('which-country'); console.log(wc([-100, 40])); // prints "usa"

it uses r-tree under hood, it's much faster linear scan (o(log n), suppose).

javascript node.js geolocation geospatial

No comments:

Post a Comment