Hugo Ledoux

associate-prof in 3D geoinformation at TU Delft
blog contact protégés publications research slides software

Tinkering with the first test area of 3DTOP10NL

The Netherlands has recently launched a “3D map” covering the whole country in which all buildings, roads, trees, canals are 3D geometries. It was constructed by adding the third dimension, obtained from airborne laser-scanners (AHN was used), to the objects in the 1:10k topographic map (some details here). This leads to a massive amount of information: 15M+ objects, billions of elevation points, and billions of triangles.

At this moment, the full dataset can be requested but only the test area is directly downloadable. The test area is Valkenburg (in the South of the country), so yes the hills you see are real, and they are the only ones in the country (we cherish them).

3D TOP10NL -- Valkenburg from hgldx on Vimeo.

While the dataset is publicly available and open (under this creative commons licence), the format currently offered is only ESRI geodatabases (GDB). Rather ironic, but I was promised that other formats would soon be available. CityGML would in theory be a good candidate, but storing all these triangles in GML would create gigantic files, so other formats are currently being investigated.

If, like me, you don’t have ArcGIS, do not despair. It’s possible to read the GDB file (or should I say folder?): GDAL/OGR has an implementation of the OpenFileGDB driver. And it works with 3D objects out-of-the-box, eg to know which layers are in the GDB:

$ ogrinfo Valkenburg.gdb/
Had to open data source read-only.
INFO: Open of `Valkenburg.gdb/'
      using driver `OpenFileGDB' successful.
1: terreinVlak (Multi Polygon)
2: waterdeelVlak (Multi Polygon)
3: wegdeelVlak (Multi Polygon)
4: gebouwVlak (Multi Polygon)
5: gebouwVlak_stat (Multi Polygon)
6: terreinpunten (3D Point)
7: wegdeelVlak_3D_LOD0 (3D Multi Polygon)
8: terreinVlak_3D_LOD0 (3D Multi Polygon)
9: gebouw_3D_LOD0 (3D Multi Polygon)
10: waterdeelVlak_3D_LOD0 (3D Multi Polygon)
11: gebouw_3D_LOD1 (3D Multi Polygon)
12: brugWater (3D Multi Polygon)
13: brugWeg (3D Multi Polygon)
14: TerreinOnder (3D Multi Polygon)

To convert the buildings (layer gebouw_3D_LOD1) to a shapefile with 3D MultiPatches (to a folder out), simply do this:

$ ogr2ogr out Valkenburg.gdb/ gebouw_3D_LOD1

and if you do this for the terrain (terreinVlak_3D_LOD0) and the roads (wegdeelVlak_3D_LOD0), you get this:

Voilà.


A word of caution though. I have noticed that the conversion done with the OpenFileGDB has errors: several triangles are corrupted! Triangles that have—as they should—3 vertices in the GDB file (I checked with ArcGIS) are after conversion to the shapefile having 4+ vertices and inner rings (triangles are simply polygons, thus it’s possible and “correct”). An example is this one (the red geometries are 1 geometry that is corrupted, and it is not a triangle):

Why does this happen? I have no idea. It happens for me with GDAL v1.11.0, under Mac OS X (Yosemite).

UPDATE: The reason why this happened is explained here (cheers to Even Rouault). Basically, if you convert to GML or Spatialite instead of Shapefile then the problem is avoided (ogr2ogr -f GML out.gml Valkenburg.gdb/ terreinVlak_3D_LOD0). The GDB file contains vertical triangles (the terrain of 3DTOP10NL is not a 2.5D terrain) and the Shapefile driver tries to construct polygons (triangles) that are 2.5D by assigning a Z value to the points (which doesn’t work).

Since it was driving mad, I wrote a small script to know if the triangles in a shapefile are valid: aretrianglesvalid.py.

If you solve this problem, please let me know.



RSSCreative Commons License