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

I want to get nodes and ways (amenity~fastfood|restaurant) for a specific area. I tried with a boundingbox, which works well, but when i change the query to use area, i only get the the first query results in the union (nodes). If i put the way-query first, i only get ways.

The QL i have so far:


[out:json];
area
  ["boundary"="administrative"]
  ["name"="Calw"];
out body qt;
(
  node
    (area)
    ["amenity"~"fast_food|restaurant"];
  way
    (area)
    ["amenity"~"fast_food|restaurant"];
);
out body qt;
>;
out skel qt;
link:Link to overpass-turbo with query running

Any help to get the ways and nodes in one run?

asked 06 Mar '13, 14:58

dooley's gravatar image

dooley
61114
accept rate: 0%

edited 17 Jan '16, 19:38

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554


You need to store the query result in a dedicated variable and to use it from there:


[out:json];
area
  ["boundary"="administrative"]
  ["name"="Calw"]->.a;          // Redirect result to ".a"
out body qt;
(
  node
    (area.a)                    // Use result from ".a"
    ["amenity"~"fast_food|restaurant"];
  way
    (area.a)                    // Use again result from ".a"
    ["amenity"~"fast_food|restaurant"];
);
out body qt;
>;
out skel qt;

Without the variable, the result of the area query is overwritten by the "node(area)..." statement. Thus the next statement doesn't find any area to recurse from.

permanent link

answered 07 Mar '13, 08:19

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

1

Thank you, works fine :-)

(07 Mar '13, 08:28) dooley

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×483
×65

question asked: 06 Mar '13, 14:58

question was seen: 10,398 times

last updated: 17 Jan '16, 19:38

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