Hi all
I’m writing a simple osm file parser in C++. Right now Im loading all the nodes, ways and relations for a country (I’m getting the files from http://download.geofabrik.de), and then I’m trying to import some of this information into my own data structures. The first thing I’ve tried is to import relations of type=boundary. For simplicity, I’m ignoring enclaves, so it seems that I should be able to connect the outer ways and form the closed polygon which represents the outer boundary. For instance, get the boundary for Luxemburg.
The problem is, I dont know how to connect the ways in the boundary relation, I’m missing something. A simple concatenation of the points in the ways do not work, as it seems like some ways go clockwise and others anticlockwise, and I end having polygons which are complex, i.e. with self-intersections. Is this the expected behaviour and I should just work harder on the algorithm which connects the ways, or is there an additional piece of data somewhere in the osm file with hints about how to connect the ways in a boundary relation?
Thanks in advance
Miquel