Distance to route?

I would like an API with openstreetmap data which returns the nearest walking/bike/horse/canoo routes given a point on the globe.
The threshold should be 5 km.
Do we have an API that can do this already?
I’m thinking if not loading all routes into a postgis database should be able to get the job done.
Any ideas for queries?

1 Like

Import into ppstgres with osm2pgsql is how if do it. Use postgis’s new kNN nearest neighbour search functionality to do it quick and fast with an index.