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

Hello to the community!

as a complete newbie in OSM and its API I first tried to read all the docs and helps and this forum, of course. But I have a problem to build a query and I do not know how to solve it without help..

My goal is having a CSV of:

  • in Germany only (47,6,55,15 ??? or {{geocodeArea:Germany}} in overpass-turbo style
  • all city names (admin_level="8" and "name")
  • relation from each city to it's corresponding county (admin_level="6")
  • the boundaries of each city

Example CSV header:

  • county-name, city ,city-boundaries,

My sadly tries:

My sources I tried:

Obviously I have:

  1. a logical problem to understand how to build a correct query which achieves the above and
  2. I don't know how to get it correctly formatted as CSV.

If you can help please do so :)

Thanks in advance





as mentioned I have opened a thread in the german forum here: forum thread



asked 31 Oct '15, 11:41

sediosm's gravatar image

accept rate: 0%

closed 08 Nov '15, 17:37

mmd's gravatar image


The question has been closed for the following reason "Follow-up on German Forum." by mmd 08 Nov '15, 17:37

I'm afraid, what you're trying to do is not possible with Overpass API. You cannot combine several OSM objects into one CSV line.

The only option I see at the moment is to split the response up into multiple lines, like in the following example for pharmacies per country. You probably came across this one, as you mentioned Overpass API by example in your original question.

In addition, try to limit the scope of your query to smaller regions and split it up into several requests. Otherwise this will take way too much time.

permanent link

answered 31 Oct '15, 12:30

mmd's gravatar image

accept rate: 37%

edited 31 Oct '15, 12:36

First of all many thanks for the ultra quick response! :)

Hm ok.. that explains why I never got good results.

Could you provide a query which gets all cities in Germany with their boundaries as csv? And a second one which gets all cities with their relation to its county (without any boundaries, just their names) as second csv?

Would that be possible?

If that would work it would be ok for me because i can do a correlation between those both csv locally..

Well and have you taken a look at my overpass_turbo query? Thats multilined but I still not able to get it working...

(31 Oct '15, 16:11) sediosm

In case that you are from Germayn or you can speak at least German, I recommend to ask all your questions in the German sub forum at ... log in there with your existing OSM account.

There are specialists about boundaries and data extractions ... there we can develop a solution for you.

(31 Oct '15, 21:16) stephan75

@stephan75: yes that's something I would also recommend. I believe there are still some topics open here and the forum format is much more suitable to discuss different details or find alternative approaches. We have some users with a dedicate osm2pgsql database and they may also be able to support.

(01 Nov '15, 16:05) mmd

That sounds great thanks I will do that :) !

(01 Nov '15, 18:27) sediosm

@sediosm: please mention a link to the follow-up thread here

(01 Nov '15, 19:44) aseerel4c26 ♦

Depending on what you want to achieve, a more user friendly way may be to use Wambacher's boundaries service. There you can select level 6 relations by level 4 area. You can then export to any number of formats. You could link level 6 to level 4 by hand, or you could use a free sowftware like QGIS to do a spacial join (calculate centroid of level 6 within their area, than spatial join of these points with the level 4)

You need to log in to the servicce with your OSM user to be able to download data.

permanent link

answered 01 Nov '15, 12:58

joost%20schouppe's gravatar image

joost schouppe
accept rate: 12%

edited 12 Jan '18, 14:55

SomeoneElse's gravatar image

SomeoneElse ♦

thanks for your thoughts I didn't mentioned the Wambachers service but I also tried it -> but I need a CSV at the end and regarding QGIS: I do not want to install a special software to doing those joins etc.. nevertheless thanks again for your reply

(01 Nov '15, 18:26) sediosm

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: 31 Oct '15, 11:41

question was seen: 8,910 times

last updated: 12 Jan '18, 14:55

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