OpenStreetMap 标志 OpenStreetMap

Bulk conversion of administrative boundaries to new OSM format in Jakarta

capiscuas 于 2015年十一月12日 以 English 发布 最后一次更新于2015年十一月17日。

Hi everybody, apa kabar?, this is my first post in OpenStreetMap so I’m quite excited.

My name is Ivan Garcia and I’ve been contributing to OSM since many years now, I am currently living in Yogyakarta Indonesia where I do digital volunteering for various projects. I am an opensource python programmer and I love useful is OSM for the world, no wonder we all feel contributing back to the community when we have free time.

I realized that HOT Indonesia contributed adding most of the administrative boundaries of the Jakarta province in order to make a program for disaster management(flood related), my thumbs up for that team and their tremendous efforts, here is their blog

I see those boundaries have an obsolete OSM format to represent the boundaries, that is, still using the obsolete is_in tags, instead of the new boundary relations.

You can take a look at here:

osm.org/#map=17/-6.172219373575377/106.8088689627239 Boundary RW03 duplicates way with RW06 Boundary RW03 duplicates way with RW06

![Boundary RW06 duplicates way with RW03] (http://imagizer.imageshack.com/img910/4026/XEHwJ6.png) Boundary RW06 duplicates way with RW03

You can see that many ways are overlapped(duplicacy). My goal is to transform all those boundary ways(hundreds of them) into OSM relations by respecting all the current tags that HOT may be using for their disaster program: (OBJECT_ID, flood_prone)

I am preparing a python script that will generate automagically all those boundaries relations by going trough each of the nodes of the current boundary ways, detect what ways are overlapped, and if necessary, and create new relations for the relations:

(See Indonesia tagging conversions) osm.wiki/WikiProject_Indonesia#Tagging_convention

  • admin_level=5 - City / Regency (Kotamadya / Kabupaten)
  • admin_level=6 - Subdistrict (Kecamatan)
  • admin_level=7 - Village (Kelurahan / Desa)
  • admin_level=8 - Community Group (Rukun Warga)
  • admin_level=9 - Neighborhood Unit (Rukun Tetangga)

Although this is not really an import but a bulk transformation of the OSM data that is already in the database, I am following the OSM Import procedure, I am informing the Indonesian mailing list as well as the Import mailing list for review and feedback.

Please comment here in the post.

Thanks.

Ivan.

位置: Gowongan, Jetis, Yogyakarta, Special Region of Yogyakarta, Java, 55232, Indonesia
电子邮件图标 Bluesky图标 Facebook图标 LinkedIn图标 Mastodon图标 Telegram图标 X图标

讨论

wambacher2015年11月12日 19:16 的评论

Hi Ivan,

are you aware that all existing “bad boundaries” are closed ways? Creating relations for them and change the tagging is only half of the job.

Boundary relations use shared ways (called members) which can’t overlap because there is only one way at an edge. That is the base concept of type=boundary or type=multipolygon.

So you have to split all closed ways on every “corner”, remove double ways and add the reminding ways as members to the new relations. Just look at some “good” boundaries in your area.

That is not an easy job.

Please ask me if you don’t understand what i mean. And sorry, if you are planning to do it this way and i did not recognize that.

btw: did you ever add/change admin-boundaries in osm before?

regards

walter aka osm-user “wambacher”

capiscuas2015年11月12日 20:05 的评论

Hello walter, yeah, that’s on my plan, I am quite aware of how to create “good” boundary relations without overlapping ways, I have quite sharp python skills and I’ve xml parsing of osm nodes, ways and relations. That’s why I mentioned ‘automagically’ script in the post.

I recognize that will be the difficult part but that’s the interesting part, everybody does hate doing repetitive tasks :-)

wambacher2015年11月12日 20:56 的评论

Hi Ivan,

i’ll cross my fingers ;)

please send me a note when you are going to created the first boundaries. just to be shure.

regards

walter

capiscuas2015年11月16日 18:34 的评论

I did a new post explaining the cleaning scripts. osm.org/user/capiscuas/diary/36340

登录以留下评论