Hello, This is my first approach at OSM, so forgive me for my lack of knowledge. I would like to have the borders from Belgium on the following administrative levels:
These borders would be read into a Java application to draw a heatmap, displaying a certain value for each municipality. Therefore it would be nice to get these borders in a format that I can read in Java (like some sort of XML), in the form of an ordered list of points (with lat/lng coordinates) that form a polygon. After browsing the OSM wiki and really breaking my head over this matter, I figured I should download a (part of a) planet file, and extract the data that I need using osmosis. So currently I have a part of a planet file (planet-benelux-120926.osm.gz) and osmosis, and this is where I'm stuck. I hope someone can help me out. Thanks in advance, Vincent asked 26 Sep '12, 03:14 Vincent Baeten |
There's a number of things you can do. One is doing it with Osmosis or osmfilter (if you can read a little German or use an auto-translator, see this forum thread). This will however only extract the ways and relations and you will still need some processing afterwards. (Simply speaking, you'll end up with a file that says "the boundary of province X is made up of parts A, B, and C ... the part B consists of points G, H, and J... the point J has the coordinate lat/lon".) If you have Linux machine and are not afraid to use it, then you could also take the osm2pgsql (or imposm) utility and import your Benelux file into a PostGIS datbase. This has the advantage that you'll then have the boundaries assembled for you (you can then do something along the lines of "select name,geometry from some_table where admin_level=6"). You can easily request the geometry as a sequence of coordinates, or even export it to KML or some other format easily readable in your Java application. There's also a rather new piece of software specially geared towards creating a set of admin shape files, here: https://github.com/bussed/osmgadm. answered 26 Sep '12, 07:55 Frederik Ramm ♦ |
It's extremely easy to do with the JOSM editor.
answered 22 Mar '13, 20:33 GentilPapou |