G
G
German Zvonchuk2019-06-12 23:39:58
OpenStreetMap
German Zvonchuk, 2019-06-12 23:39:58

How to create a Geocoding service with your own hands?

Hello, friends!
I have such a task, I need to geo-code the coordinates and get the output

  • Country, City, District,
  • Country, District, Settlement
  • Country, City, District, Settlement
  • Country, District, City, Settlement

In Google Maps, the data is not always correct, entered in different languages, the tree is almost always incorrect, and most importantly, they charge $ 1 for 1000 requests, and I need to make at least 10 thousand requests per day.
OSM knows almost everything, but the answers, I mean the naming of objects, are also not always correct.
In this regard, I had an idea, maybe I should collect the polygons of all the cities and regions I need, and do geo-coding myself?
The area that I need to cover is, in principle, not large.
  1. 66 districts of republican subordination
  2. 12 cities of republican subordination
  3. 7 districts and 1 city subordinate to the autonomous republic

In addition to geocoding, I also need to get a list of cities sorted by distance, first the nearest and descending, with the obligatory indication of the distance.
To create this functionality, I still need to save the coordinates for each city.
Here I also thought that if and to save polygons.
The question here is what, on what is it easier to implement all this?
Where to store data? In MySQL and Elastic?
The task, as far as I understand, boils down to the following, to find all the polygons that include a geo-point?
I would be very grateful if you share your experience or suggest a solution.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Moskus, 2019-06-12
@Moskus

- Export polygons from OSM (via Overpass API, for example),
- Edit them to reflect the hierarchy and names you need (using QGIS, for example), and also to simplify the geometry (get normal closed curves from OSM multipolygons),
- Load resulting in a database with support for spatial functions (SQLite / SpatiaLite, PostgreSQL / PostGIS) in the form of geometry
- Get what you are looking for using spatial queries by the condition of finding the geometry inside the geometry and sorting by the result of calculating the distance.

P
pfg21, 2019-06-13
@pfg21

Nominatim is an osm tool for forward and reverse geocoding. you need a reverse.
there are a lot of articles on how to deploy nominate on your server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question