Using Overpass I'm trying to get the admin_level 2, 4, and 6 parents of wikidata Q16557 (Dallas, Texas, but I want to be able to do this for any US city).
This query works fine for admin_level = 6 (returning all five counties that the city of Dallas is in):
[out:json];
area[wikidata=Q16557]->.a;
(
relation[boundary=administrative][wikidata][wikipedia][admin_level~"6"](area.a);
);
out tags;
But if I change it to admin_level 4, I'm expecting to get Texas, but I get no results:
[out:json];
area[wikidata=Q16557]->.a;
(
relation[boundary=administrative][wikidata][wikipedia][admin_level~"4"](area.a);
);
out tags;
And if I change it to admin_level 2, I'm expecting to get the United States, but I still get no results:
[out:json];
area[wikidata=Q16557]->.a;
(
relation[boundary=administrative][wikidata][wikipedia][admin_level~"2"](area.a);
);
out tags;
Is my original query correct? It always seems to work with finding the county(ies) a city is in.
Is there any reason it would work for admin_level 6 but not 4 or 2?