NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

How do I make a query that returns me every admin_level=7 relation in Poland that doesn't have a member with admin_centre role?

This is a pre-requisite to another thing - After fixing these (if needed, I wanna find out) I want to list every place in Poland that should feature amenity=townhall, but has none. This is what I've got currently:

In this second query I also have to solve a problem: Some rural municipalities have their seat outside them, how do I exclude these? cf.

asked 15 Jan '16, 01:58

RicoElectrico's gravatar image

accept rate: 0%

edited 15 Jan '16, 21:42

aseerel4c26's gravatar image

aseerel4c26 ♦

I will focus on your first question atm. If possible, please move your other question to dedicated threads.

Here's how the query should look like



( rel(area.boundaryarea)[boundary=administrative][admin_level=7]; -

  ( node(r:"admin_centre")->.a;

out geom;

Overpass Turbo Link:

A few words how this works:

  • We initially get a boundaryarea as defined per Poland's admin_level=2 boundary
  • Now we determine difference of all admin_level=7 boundaries in that area MINUS those admin_level=7 boundaries having an admin_centre node.

Read more about the recurse functions used in this query here.

Note that there are some relations returned outside of Poland. This is not a bug in the query, but rather some outdated areas on See this thread for details. It works just fine on our dev box with up-to-date areas.

permanent link

answered 15 Jan '16, 20:11

mmd's gravatar image

accept rate: 37%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 15 Jan '16, 01:58

question was seen: 2,879 times

last updated: 15 Jan '16, 21:42

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum