Identification of locatons using coordiates

web project (php, mysql), 200k + sites

We need to clearly identify the location of the user on the site and identify city to him. For a clearer identification of locations, we want to use city boundaries. Now we just use GeoIP lite from MaxMind. We do not want to use the GeoPy request because there are problems with the fields being passed:

  1. Translation of cities, and the fields in which they are transferred are very different usually
  2. Searching for OSM id does not make sense, because we will get accurate coordinates from user, even if not accurate, GeoPy will still post it for us.
    https://nominatim.openstreetmap.org/reverse?format=json&osm_type=N&accept-language=ru&lat=-6.165&lon=106.847
    https://nominatim.openstreetmap.org/reverse?format=json&osm_type=N&accept-language=ru&lat=50.42&lon=30.35

Therefore, we will assign the location on the server side.

And here is the question.
Where can we get a location polygon database or maybe somewhere we can api request to OpenStreamMap to get coordinates for your database (MySQL),

On the example Kyiv
http://polygons.openstreetmap.fr/get_geojson.py?id=421866&params=0

Maybe there are some other ideas, I’ll be glad to read.

It very much depends on what you mean by city. There is a polygon for the Leeds administrative district which encompasses many places which would conventionally not be regarded as in Leeds (for instance Whetherby). Such areas can be queried using the Overpass API.

If you need urban areas for cities & towns then we don’t have such data.