Fixing Jakarta boundaries (and II)
Posted by capiscuas on 30 November 2015 in English. Last updated on 1 December 2015.After few days of working with the quality assurance of the original OSM data extracted I finally finished the python script that generates the administrative boundary relations from level 5 to level 9
All the .osm files(original and results) can be downloaded here to check them out.
Here are the statistics and screenshots:
- Original ways: 7717 (between level 8 and some level 9)
- (after conversion) Splitted ways/segments: 21627
admin_level=9(in Indonesia: RT) 5006
admin_level=8 (RW) Total: 2708
admin_level=7 (Desa) Total: 263
admin_level=6 (Kecamatan) Total: 44
admin_level=5 (Kabupaten) Total: 5
The script takes all the ways from the OSM file and detects the intersections with other ways in order to split them into small segments(some segments will belong to different administrative boundaries).
It’s important that if you want to use the script to convert the boundaries into OSM format, take a good look at it, understand it, and ask for help if there is something that doesn’t understand. The script can be found here: create_administrative_boundaries.py. I added enough comments, you can use github to send feedback too.
The script is specific for the current data from Jakarta, it would be very hard or hardly impossible to make a universal script that can work with any data, therefore it’s better to understand it and modify it for your needs. You can also send me a private message or email at capiscuas AT gmail DOT com if you want help with some boundaries conversion.
During the creation of the script, many warnings or errors appeared when the data had some gaps or duplicates, for example some level9 or level8 names were missing, or had some typos, or some ways had the wrong level5(For example I found a small part of Central Jakarta inside East Jakarta boundary.
You will also see in the original file I had to add some auxiliary ways in the external(outter) parts of the region in order to force the splits(for those nodes shared by more than 3 ways which didn’t happen at the external part).
The HOT Indonesia data regarding flood management has been saved also in the relations, if that is not needed anymore, it can be easily removed later on with JOSM from the database.
I would like interested people in the area to give some feedback before importing all the generated relations and remove the current ways from OSM.
Things to do: -Simplify all the ways(some ways have many nearby nodes with similar angle). -After uploading the new boundaries I will join the external ways with with the neighbouring level4 areas.
Discussion
Comment from Iyan on 9 December 2015 at 00:24
Hello Ivan,
There might be duplicates on the Kelurahan/Desa(admin level=7). I assume you only take the Jakarta admin boundaries minus the Kabupaten Kepulauan Seribu (admin level=5). The total for Kelurahan for the whole DKI Jakarta province is 267. Reduce this number with Kelurahan in Kepulauan Seribu (6) we got 261, while the result from above is 263. I have identified the duplicates, the first one is TMII, which is a recreational area. The second one is Suka Pura and Sukapura. I believe the later is the correct ones. I use this link from Ministry of Home Affairs to check: http://www.kemendagri.go.id/media/filemanager/2010/01/29/1/1/11__dki_jakarta.pdf
Comment from capiscuas on 10 December 2015 at 18:12
Hi Iyan(almost similar name), yeah, I totally forgot about kabupaten kepulauan Seribu. I added them now, and fixed them a bit, for example each pulau was linked to kabupaten Jakarta Selatan. I also added Pulau Harapan as kelurahan so in total are 6.
I fixed a bit Wikipedia ID when I saw some inconsistency about the links or names. I removed TMII as admin_level=8 relation, and fixed the Sukapura duplication.
Check the 0.2 version and if everything is ok, I will upload it in the next days… https://dl.dropboxusercontent.com/u/1599184/others/osm/boundaries_jakarta_v0.2.osm.zip
Great work in HOT Indonesia btw.
Best Regards.