Closed teknolojia closed 5 years ago
With the function below I get list of cities in a certain country which includes lon and lat.
module.exports.getAreas = function (country) { const citiesArray = cities.filter(city => { return city.country.match(country) }); return _.sortBy(citiesArray, o => o.name) };
I want a way to use lat and lon to guess the city from this lib. Something like this:
module.exports.findArea = function (lon, lat) { return ........ };
I know its not the purpose of the lab, Any advice on how I can do it?
Hi @teknolojia! I think modules like https://github.com/zeke/euclidean-distance or https://github.com/zeke/nearby-cities might work for you.
@zeke thanks.
With the function below I get list of cities in a certain country which includes lon and lat.
I want a way to use lat and lon to guess the city from this lib. Something like this:
I know its not the purpose of the lab, Any advice on how I can do it?