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

Finding Areas within Areas with Overpass QL

0

Hi All,

I'm having a bit of trouble running queries for areas that are within other areas. For example:

area
  [name="United States of America"]
  [border_type=national] -> .usa;
(
  area
    (area.usa)
    [admin_level=4]
);
out 100;

I would expect this to return a list of states in the US. However, what I actually get is a random hodgepodge of areas with admin_level=4, not just those in the US. Am I misunderstanding the area syntax?

asked 07 Mar '14, 04:15

sib's gravatar image

sib
6111
accept rate: 0%


2 Answers:

3

There are two different problems entangled:

Overpass API doesn't support to query for areas in areas. It is just not implemented, but you could get a similar result with the query

[timeout:3600];
area
  [name="United States of America"]
  [border_type=national] -> .usa;
(
  rel
    (area.usa)
    [admin_level=4];
);
out 100;

It is unfortunately really slow.

Second, there are a lot of relations (and thus areas) tagged with "admin_level=4" although they are not states. One example is relation 80297 which is a park somewhere in Ohio.

answered 07 Mar '14, 10:03

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

1

Unfortunately, it is not yet possible to search for areas inside other areas. See this ticket on github. :/

answered 07 Mar '14, 08:49

tyr_asd's gravatar image

tyr_asd
1.2k51927
accept rate: 64%

Source code available on GitHub .