NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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:

  • 2 (national border)
  • 4 (regions)
  • 6 (provinces)
  • 8 (municipalities)

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%20Baeten's gravatar image

Vincent Baeten
11112
accept rate: 0%


It's extremely easy to do with the JOSM editor.
Focus on any part of the Belgian boundary and File>download the map around it.
You've go the Belgian relation. Select it (right-click>Select relation)
Create a File>New layer and Edit>Merge selection into it.
Then successively select boundaries[X] (of lower level X) and right-click>Download incomplete members.
You've got boundaries down to level X.

As it still needs installing JOSM and some expertise, I have done that for you.
You will find the files here.

permanent link

answered 22 Mar '13, 20:33

GentilPapou's gravatar image

GentilPapou
160146
accept rate: 0%

edited 22 Mar '13, 20:40

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.

permanent link

answered 26 Sep '12, 07:55

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

edited 08 Oct '12, 07:46

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×252
×129
×56
×37

question asked: 26 Sep '12, 03:14

question was seen: 17,289 times

last updated: 22 Mar '13, 20:40

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum