So I have a coordinates - latitude & longitude. Is there a way or a library out there that would return a country based on those coordinates? Google services or any other API will not be suited as I need to be able to do it offline and handle big amounts of requests also.
Asked
Active
Viewed 78 times
1
-
You will need a "database" of some sort. Maybe the [city databases](http://download.geonames.org/export/dump/) mentioned [here](https://stackoverflow.com/a/6355183/2615905) help? – T_01 Mar 25 '22 at 10:49
-
2do you realize that there are thousands of countries and that none of them has a circular shape, without neglecting the fact that many of them have territories scattered all over the globe? What you want can't be summed up in a simple answer – Mister Jojo Mar 25 '22 at 10:50
-
1If you want to search the internet for *countries latitude and longitude* you will find some databases. For example [world_country_and_usa_states_latitude_and_longitude_values.csv](https://www.kaggle.com/datasets/paultimothymooney/latitude-and-longitude-for-every-country-and-state). You will have to do some calculation yourself, as those kind of lists will not account for the shape of the country, only their center. – Peter Krebs Mar 25 '22 at 10:54
1 Answers
0
What are you looking for is called reverse geocoding.
For javascript, there is an OfflineGeocoder library, that uses GeoNames data.
St.Shadow
- 1,850
- 1
- 12
- 16