The porblem I have is that I fetched the data about the administrative level of vienna (from OSM via overpass --> vienna relation id = 109166) as xml format. (json didn't work it had encoding problems) As I did not find any information of how to get it directly, I had to see if I could create the filled polygon with the data provided. With the ways included, forming a polygon itself doesn't work as some ways only have two nodes. Therefore, I created LineStrings in order to generate the border of vienna and saved it as a shapefile.

It looks like this: enter image description here

Indicated by the different colors, one can see the LineStrings that form a polygon. Now I would like to fill the area so that I can use it as a filled polygon. I am using ipython (with python 2.7) and currently searching for answers for the best approach to do this. Would be nice if there is a function that ipython can interpret all LineStrings and see that they are closed so it can write it as a polygon. Then I could identify it as polygon in order to fill the area. Working with programs like QGIS is not an option as I want to avoid manual corrections.

Dropbox link for shapefile

What I want is just a filled polygon of this relation in ipython.

  • Please edit your question to specify the GIS software you are using. – Vince Dec 5 '16 at 22:17
  • If I save the output from overpass-turbo.eu as geojSON for that ID I get a perfect polygon that fills nicely when loaded into QGIS. You're doing something wrong... – Spacedman Dec 5 '16 at 22:26
  • When trying to fetch the data in json I always encounter encoding problems in ipython, therefore, I did it in xml and created a shapefile with it afterwards. – Apachai Dec 6 '16 at 13:29
  • @Spacedman How do you get geojson as output from overpass? If I try to do this I get an error. (e.g. overpass-api.de/api/…) When changing "geojson" to "json" it works, but I have the problem of converting it to "geojson", which I did not find a solution for in python 2.7 – Apachai Dec 6 '16 at 22:59
  • I'm using overpass-turbo: overpass-turbo.eu/s/kuS - run, then export as geoJSON. – Spacedman Dec 6 '16 at 23:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.