finding pois along route

Hi OSM community,

I would like to have an option identifying certain POIs along a given track. E.g. I download a track from a repository, now I want to plan my approach to it, and e.g search for drinking water in a distance of max. 20m to this track.

With opverpass API I can succesfully search for all amenity=drinking_water in a bbox, or geographical area, I can also query for those amentiy=drinking_water which are close to highway=asphalt (or waterever other criteria you would want to apply). But this would plot all the available POIs on the screen, which can be many, and I would have to hand-pick those along my track. I cannot find a way to perform these queries just along a given gpx-track.

Do you have any suggestions either for structuring the query in a fashionable way, or for a dedicated tool?

Many thanks and kind regards

I wrote a blog post a few years ago on how to achieve this using Overpass API:

It’s not the most intuitive way, but it definitely serves the purpose, and delivers the right and desired output. Many thanks!

a follow-up question: have you ever tried doing the same thing in python? E.g. reading the route-planning.gpx, then running the query with the coordinates supplied by this gpx. I tried for some days now, but my coding skills are too underdeveloped. I can parse the gpx and get the coordinates of all waypoints. I can run an overpassAPI-query, but I cannot combine them (use / import the coordinates of the gpx in the query)