NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Wondering how to write an Overpass query to find ways in cycle route relations that have surface=paved tagged on the way. Here's my best effort, which is doing fine getting ways within cycle relations, but is not filtering for ways tagged surface=paved:

.sp out body;
out skel qt;

Note: this question came up on GIS StackExchange

asked 17 Jun '15, 15:32

neuhausr's gravatar image

accept rate: 21%

I suggest instead.

Let's also do a walk-through of the above query:

The parentheses opening in line 2 and closing in line 6 mean that the input of line 8


are the union of the results in lines 3, 4, and 5. In particular, in line 3 we collect all the relations with "route"="bicycle". Thus, the recurse-down collects all the ways that are members of these relations. In line 9, these resulting ways, along also found nodes from these ways, are printed.

To avoid this, you need to remove the parentheses in line 2 and 6. Fruthermore, the parentheses in lines 3, 4, and 5 also have no effect, because there is in each case only a single query inside.

The remaining differences are that I have simplified the different set names to always the default set name. Because some relations may have an enormous extent, I have also added a "({{bbox}})" condition to the "way" query to restrict the results to the given bbox. It would work without, but admittedly slower. To speed up without bounding box, you can use

out geom;

This splits the way query into two steps to enforce that the filtering for relation members is applied first.

Please feel free to paste back the content to GIS StackExchange. I consider my answers here as CC0.

permanent link

answered 17 Jun '15, 17:05

Roland%20Olbricht's gravatar image

Roland Olbricht
accept rate: 36%


Thanks so much, especially for the walk-through pointing out where I went wrong!

(18 Jun '15, 14:39) neuhausr

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 17 Jun '15, 15:32

question was seen: 6,793 times

last updated: 18 Jun '15, 14:39

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum