If I want to find the nearest thing (supermarket, brewery, hospital, etc) from a point, what should I do?
I know I can use the POIs service and give a bounding box, but I’d prefer something less wonky, such as a single point. Even then, I don’t really want to have to give a point and a radius, get a list of all the matching items, and sort through them all looking for the one with the shortest distance. Even worse, what if the shortest distance is only as the crow flies, but not shortest distance by roads/other paths? I guess that last bit doesn’t really matter.
I think searching for the nearest thing is a bit vague - what would a “thing” be? A street lamp? A pedestrian crossing? A tree? If you’re looking for POIs then although this is not the intended use, you can re-purpose the POI service for this:
I am currently using the POI service with a filter for category ids to find the nearest thing, thing being supermarket, hospital, whatever my options are from the Places list. Sorting by distance and setting the limit to 2 sounds like the fix I was looking for, thank you.
Does it have a distance limit? What exactly does the buffer do?
Thanks for the tip on the limit+1, that would’ve thrown me for a loop.
I’d assume that this might be because it also applies to a polygon - I am not sure though. Documentation for the endpoint is lacking a bit in clarity, unfortunately
The limit is 2000m to be exact. Not sure if it is in the docs, but you get a proper error message stating the max buffer if you go over it, so it’s easy to find out