komoot / photon

an open source geocoder for openstreetmap data
Apache License 2.0
1.94k stars 286 forks source link

Find results that match an osm_tag (Not filter after search). #785

Closed mb12 closed 7 months ago

mb12 commented 7 months ago

Hello, Is there some way to find all results that match a particular OSM tag. Such a search query would not have the "q" parameter.

For e.g. something like this to find all restaurants.

?osm_tag=amenity:restaurant&limit=50

Please note that I am not trying to filter results after search. I want to find OSM objects that much a particular tag in the view port and drop pin there.

mtmail commented 7 months ago

Tools like Overpass API (which can be installed locally) are better at "all Z around X,Y" type queries, especially if you're looking for 10s or 100s of results.

mb12 commented 7 months ago

@mtmail Thanks for the response. I only want to run elastic search instance in the production to serve such queries. I want to serve all search queries via elastic search instead of running a separate postgres server in production for these queries.

PS: I am not looking to download OSM data covering an area. I already have OSM data imported in my development machine in planet_osm* tables. nominatim imports everything into postgres first via osm2pgsql as the first step. photon uses this db as an input data source to create an elastic search index.

mb12 commented 7 months ago

One use case for such a query would be to implement "Explore nearby" kind of functionality that's available in Google maps etc.

lonvia commented 7 months ago

See https://github.com/komoot/photon?tab=readme-ov-file#filter-results-by-tags-and-values Tag filters can be used with reverse to filter for certain objects by OSM tag around a geo coordinate.