Return only boundary=place via overpass

I have a pretty basic query and all I want is the ‘boundary’ of the ‘place’ but I am harvesting some other features too.

[out:json][timeout:30];
// --main area
area[name=‘Western Cape’]->.b;
// – target area ~ can be way or relation
relation(area.b)[name=‘Woodstock’];
map_to_area → .a;
// print results
out geom;

How do I harvest the ‘boundary’=‘place’ geom only please?

Hi,
do you mean place=suburb polygons like this one:

1 Like

In the right direction; yes.
But the query must not restrict ‘place’ to a ‘suburb’.

I want ‘boundary=place’ based on the map_to_area → .a; please.

There is no boundary=place data in that area.

This query gives all place=suburb/town etc. polygons within western cape:

EDIT: I forgot place=village

I added [name=‘Woodstock’]. Like this:

[out:json][timeout:30];
area[boundary=administrative][name=‘Western Cape’] → .a;
(
relation[place][place~“sub|town|city|count|state|village|borough|quarter|neighbourhood”]name=‘Woodstock’; );
out geom;

Thank you.

FYI There’s no need to save area to a variable, [place] isn’t required, union brackets aren’t required & it speeds the search if you use regex code to define how to search - ^ =starts with, $ = ends with.

area[boundary=administrative][name="Western Cape"];
wr[place~"^(sub|town|city|count|state)"](area);
out geom;
1 Like

@DaveF what is wr please?

A query on ways and relations, used when looking for multiple types. Slightly more information is available here.

1 Like