We are getting a lot of data and are trying to build a system on our database which can convert latitude-longitude information to city and country. We don't want to use any of the google Api's. We want to set our own server to do this.
Take a look at Nominatim. It is a popular service for OpenStreetMap capable of answering geocoding and reverse-geocoding queries. It is also possible to set up your own Nominatim instance. If you want to use a public instance instead then make sure to comply with OSM's Nominatim usage policy because the server runs on donated ressources. Alternatively you can use another public instance, for example the Nominatim instance provided by MapQuest.
If you plan to do a do-it-yourself on a server, the simplest way I would recommend is to use a FREE database of cities that include a latitude/longitude of the city's area centroid. Import the dataset into your own database.
You can then do a distance check (query) between your point and the area centroid looking for the city centroid the point is closest to. Just remember for performance purposes:
- Store the cities latitude/longitude as a geospatial POINT() datatype (not as a decimal!)
- Create a geospatial index for the field that has the POINT() value for the city center.
If you use MySQL, there are a lot of answers in stackoverflow on how to do this (just search):
Here are some FREE datasets:
MaxMind: http://www.maxmind.com/en/worldcities
Geonames.Org: http://www.geonames.org/export/
OpenGeoCode.Org (I am a co-founder of this open data project): http://www.opengeocode.org/download.php#cities
You should setup your own Nominatim server, you can find step by step instruction here http://nominatim.org/release-docs/latest/admin/Installation/
or
https://gist.github.com/malkitsingh/737ea34abec5b079a84dd39e3b0dc2d2
but for this you will need strong server with lot of space.
© 2022 - 2024 — McMap. All rights reserved.