This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Overpass API Searching

0

I am looking into switching our apps mapping platform away from google maps. After a bit of trail and error, I was able to get a somewhat working example. I however have run into a deal breaking scenario.

The scenario I have is this. Given a users current location, find me all of the POI's in their area based on a specific amenity or cuisine type.

Ideally I would like to use the current users lat/lng to determine where they are and then do a radius search based on this.

The question I have is, how do I pass the current users lat/lng into the Overpass api? The only thing I can see is that I can set a bounding box.

This is the current (non working) query that I am using

<osm-script output="json" timeout="25"> <union> <query type="node"> <has-kv k="cuisine" v="coffee_shop"/> <around radius="1000"/> <bbox-query {{bbox}}=""/> </query> </union> <print mode="body"/> <recurse type="down"/> <print mode="skeleton" order="quadtile"/> </osm-script>

asked 10 Feb '14, 23:21

Tempname's gravatar image

Tempname
1111
accept rate: 0%


One Answer:

4

The Overpass API does actually support this directly in the around statement:

<around radius="1000" lat="52.3691" lon="4.88941" />

Or see this example.

answered 11 Feb '14, 08:54

tyr_asd's gravatar image

tyr_asd
1.2k51927
accept rate: 64%

Source code available on GitHub .