For the internal information system, it became necessary to work with information tied to ordinary residential buildings.
It is trivial to display a card – every first one can do it. In particular, a map of houses has already been made in half an hour, based on OpenStreetMap / Leaflet, where each house for which there is a geotagged record in the database is marked with a marker.
The problem arose in reverse geocoding – how to make it possible for the user to click on a building polygon on the map, and the address of this object was recognized? Those. a “new” (for the company) house appears, which must be added to the database. The user goes, clicks on the house, the panel for adding an entry for the house at the given address appears. If it clicks not on the house, but on something else, nothing happens (because there is no object in this place).
A quick fix was to use Nominatim, but the results of reverse geolocation by coordinates leave much to be desired, and the result is not so hot. I poke into a wasteland outside the city, I get an address somewhere in the city, and it’s not even really clear where it is (the landfill is not returned). I would like to get an answer either “I don’t know anything here” or “there is a building object, no one has assigned an address to it on OSM yet (it’s okay, we’ll write it ourselves and send the edit to OSM), but in general this is a polygon with 4 vertices, the coordinates are attached.” At point-blank range, I can’t find anything more or less ready-made in a pile of disparate documentation.
There is, of course, an option – download the OSM dump, push it into PostgreSQL with PostGIS, and, after reading the documentation, make your own geocoder. But I'm sure I'm not the first with such desires, and there is already something more ready than building the whole bike from scratch.
Scale – a small town, roughly – up to 10,000 buildings. Up to the point that you can cut into squares (roughly, 10×10), and do everything client-side. Requests for geocoding – up to, probably, a couple of dozen on a particularly fruitful day, that is, mere trifles.
Yes, Google Maps, Yandex.Maps, 2GIS – thanks, it doesn’t fit, they all have a license agreement that requires a) use for a site open to all, and not an internal corporate admin panel, and b) severely limits the ability to use the data received from the geocoder ( consider vendor lock-in).
There was also a similar issue. But we initially had PostgreSQL deployed with PostGIS to store geo-data.
If you need to get a house by coordinate for a large number of coordinates, then it is better to simply query the database directly. Finding a point in the geometry and then choosing houses is not difficult.
If you need to get a house from the client (web browser) when you click on the map, then OpenLayers and GeoServer allow you to get the necessary information by calling WMSGetFeatureInfo (). You will only need to filter the output and select only houses.
At one time I looked at various systems for a reverse geocode, but for my tasks it turned out to be much easier to use the approach described above in all plans.
In your case, your geocoder, as you put it, will come down to writing a couple of queries to the database. So I recommend setting up PostGIS, uploading only your city there and updating it periodically.
By the way, it is not necessary to edit the combat PostgreSQL. It would be even better if you set up a separate database for geo-data.