2
votes

I'm using mapbox (https://www.mapbox.com/mapbox.js/api/v2.0.1/) and wounder if there is a way to get the country (or city?) of a [lat, lng] pair.

Would be nice if somebody could help me out :)

Kind regards

3

3 Answers

0
votes

Here is a package for that: https://github.com/vkurchatkin/which-country You can install it via npm and use in browser with browserify. The API is quite simple:

var wc = require('which-country');

console.log(wc([-100, 40])); // prints "USA"
0
votes

Ok I have now fixed that task with http://www.mapquestapi.com/geocoding/#reverse Works pretty good for me.