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

Quering naturals and amenities around some point

0

Hi, I am new to overpass api.

This is my query:

(node(around:2000,57.179,24.709)["amenity"];way(around:2000,57.179,24.709)["amenity"];way(around:2000,57.179,24.709)["natural"];way(around:2000,57.179,24.709)["landuse"~"forest|grass"];);(._;>;);out body;

What I am wandering is that I need 4 times to repeat around command.

What I want is to have my location, and have all naturals and amenities (landuse=forest or grass) as well around my location.

Isn't there more effective way to make the same query... Also I would prefer buildings, but when I add buildings, then the query runs long time...

asked 06 Mar '16, 17:53

Shazard's gravatar image

Shazard
11112
accept rate: 0%

edited 06 Mar '16, 17:55

scai's gravatar image

scai ♦
33.3k21309459

You need to repeat your location as you make the union of 4 different queries. I guess you speed it up a bit by dropping the parts where you look for landuse points (or building points), as most of them will be mapped as areas. OTOH, you should include relations in your query, in order to obtain the multi-polygons

(07 Mar '16, 06:46) escada

One Answer:

0

This is not possible in Overpass API, but it is possible in Overpass Turbo (which is just some sort of IDE written around Overpass API).

Overpass Turbo allows you to define "shortcuts" that you can use to refer to a common query part. See the example here: http://overpass-turbo.eu/s/eQU (it creates a new shortcut names "area" that uses the definition of that "around" command).

However, if you want to execute the query on a regular Overpass API server (f.e. via a http request on a webpage), you must get rid of these shortcuts again. You can get a valid Overpass API query by using one of the export options in Overpass Turbo.

answered 08 Mar '16, 13:15

Sanderd17's gravatar image

Sanderd17
1.1k51637
accept rate: 31%

Source code available on GitHub .