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

How can i exclude ‘admin_centre’ from my output?

0

I am working on project where i need the boundaries at admin level 6 in geojson format. I am using the following query. but the output of the query also includes "admin_centre". I dont want admin_centre in my output. how can i archive this?

Query:

[out:json][timeout:25];
{{geocodeArea: india}}->.searchArea;
(
    relation(area.searchArea)["type"="boundary"][admin_level = 6];
);
out geom;

asked 02 Dec '20, 11:58

PramodG's gravatar image

PramodG
11224
accept rate: 0%

edited 03 Dec '20, 03:55

maxerickson's gravatar image

maxerickson
12.7k1083176


One Answer:

0

Build up the data directly instead of using out geom;:

[out:json][timeout:25];
{{geocodeArea: Indiana}}->.searchArea;
rel(area.searchArea)["type"="boundary"][admin_level = 6];
out;
(
  way(r);
  node(w);
);
out skel;

http://overpass-turbo.eu/s/10NK

The first out; is the boundaries and then the out skel; only includes the parts of the ways and nodes that are needed to construct the geometries.

(Note that I've used "Indiana" to make the example query complete faster)

answered 03 Dec '20, 03:53

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

edited 03 Dec '20, 03:56

Source code available on GitHub .