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

Getting all places lying within the boundary=administrative and matching by name

0

I am trying to get all place=* nodes lying within boundary=administrative area and matching by name but it always times out even for very small bbox. Is there a problem in my query?

[out:xml][bbox:{{bbox}}][timeout:120]; ( area({{bbox}})["boundary"="administrative"][name]; )->.admins; ( node({{bbox}})[place][name]; )->.places; foreach.admins->.admin( node.places(area.admin)(if: t["name"]==admin.t["name"]); (._;>;); out; );

asked 13 Jan '23, 16:32

star_Martin_star's gravatar image

star_Martin_...
16113
accept rate: 0%


One Answer:

1

Not 100% sure, but I think area on;y works on specifically named objects so I've searched for relations & then converted them to areas. Unsure what area your searching so I've added an admin_level to restrict the output.

https://overpass-turbo.eu/s/1q7p

[bbox:{{bbox}}];
rel[boundary=administrative][admin_level=6][name];
map_to_area;
for(t["name"]) {
node(area)[place][name](if:t["name"] == _.val);
out meta center;
};

answered 13 Jan '23, 19:03

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

Source code available on GitHub .