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

overpass query roads within polygon

0

Hi,

I'm trying to get a list of roads within a community, but I get a timeout error when I try this. On very small queries it does work (e.g. highway=path). And on bbox too. Is this particular to querying within areas?

[out:json][timeout:25];
  ( area["name"="Halle"][admin_level=8]; )->.a;
(
  way["highway"]["name"](area.a);
(area.a)
);
out body;
>;
out skel qt;`

asked 11 May '17, 10:35

joost%20schouppe's gravatar image

joost schouppe
3.4k245087
accept rate: 12%

reverted 11 May '17, 15:35


One Answer:

2

I can't offer an underlying explanation as to why, but the timeout is related to the area query returning multiple areas. A workaround is to request a specific area, like: area(3600206480)->.a;.

Use pivot to inspect the results of an area query:

[out:json][timeout:25];
area["name"="Halle"][admin_level=8]->.a;
(way(pivot.a);
rel(pivot.a););
out geom;

answered 11 May '17, 11:08

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

1

Increasing the allowed time usually works too (i.e. set timeout:250 instead of timeout:25)

(11 May '17, 11:53) Hjart
1

Yes, a larger time-out did the trick in this case. But I somehow missed clicking the zoom to data, so I didn't see there were more Halle in the world. My first try to limit the results to Flemish communities did not seem to work though... ( area["name"="Vlaanderen"]["admin_level"="4"]; )->.b; ( area["name"="Halle"]admin_level=8; )->.a;

(11 May '17, 15:56) joost schouppe

OK, found it: you need to first create areas, then require your results to be in both areas simultaniously: http://overpass-turbo.eu/s/oYf

(11 May '17, 18:16) joost schouppe

I don't know the performance but worry about the way[highway](area.b) query being expensive. An alternative way to find the inner area is to use a map_to_area query: http://overpass-turbo.eu/s/oYg

It's a known issue that area limiters don't work on area queries.

(11 May '17, 18:33) maxerickson

Source code available on GitHub .