Hi! I'm brand new to OSM data, so please be patient with me :) I want to extract administrative (or for that sake all named) polygons from OSM data. I have read https://help.openstreetmap.org/questions/8273/how-do-i-extract-the-polygon-of-an-administrative-boundary, but it does not work for me. Here's what happens on my machine:
I assume that is due to the process running out of memory (It's a VM without swap space...). However, I am not entirely sure that script does what I want. I read somewhere that it translates full relations to polygons. And AFAI understand, there are no full relations in the OSM extracts? I also don't speak pearl to check. If I was to write a python (right choice?) script to derive named polygons from OSM extracts how would I process the data? Here's my understanding of the data. Pleas correct me where I'm wrong:
So my script would have to
Is that right? Is that what the perl script does anyways? Is it easier/faster to load the data into postgres using one of the available tools instead of processing the data in a script? All suggestions are appreciated! K asked 31 Oct '12, 22:25 konstantin |
You can use the administrative boundary data only as input. This reduces the amount of data by orders of magnitude. For example http://overpass-api.de/api/interpreter?data=(rel[name="United Kingdom"];>;);out; will return exactly the boundary data of the nation "United Kingdom". answered 01 Nov '12, 19:17 Roland Olbricht |
Extracting multipolygon data from OSM is hard. Don't try to write the code yourself, there are already several implementations out there that do that. I always recommend Osmium/osmjs, but I am biased. :-) answered 01 Nov '12, 08:36 Jochen Topf Ha, Jochen, now I understand how you're biased! Osmium seems like a tool that could do what I need. I will give it a shot. However, you mention several implementations, the most popular probably being Osmosis. Are there more? Could you point me there? Thanks!
(01 Nov '12, 10:10)
konstantin
|
Just to get around the memory issue (and to see if it actually does what you want) maybe try a smaller input file, like perhaps one of the English counties from here?