Assignment 2

Enriching the 3DBAG with new attributes

Deadline is 28 May 2025 at 01:45 pm

Late submission? 10% will be removed for each day that you are late.

You’re allowed for this assignment to work in a group of 3 (and thus submit only one solution for all of you). If you prefer to work alone or in pairs, it’s also fine.

The assignment is worth 20% of your final mark.

cover



Overview

In its current form, the 3DBAG dataset contains for each of the 10M+ buildings in the Netherlands:

  1. the 3D geometry at three LoDs: 1.2+1.3+2.2
  2. several attributes, eg the construction year, the height of the ground, the type of roof, current status of the building, etc.

For this assignment, you are asked to calculate a few useful attributes (those can be useful for others when processing the 3DBAG files) and to add them to the file.

The attributes we want you to add are:

  1. volume
  2. orientation
  3. area+orientation of the "RoofSurface" surfaces
  4. geometric difference between the LoD1.3 and LoD2.2 (with Hausdorff distance)

The updated model must be delivered in the CityJSON format.

Your code should be able to read any 3DBAG file as input

The 3DBAG, developed by the 3D geoinformation group at TU Delft and by 3DGI (and also the topic of Lesson 7.1), is a dataset containing 3D models of all the buildings in the Netherlands. The 3DBAG is open data and it contains 3D models at multiple levels of detail (LoDs), which are generated by combining two open datasets: the building data from the BAG and the height data from the AHN. The 3DBAG is updated regularly, keeping it up-to-date with the latest openly available building stock and elevation information. More details about the 3DBAG are available on its website.

The buildings are tiled (there are a bit less than 11 million buildings by the way), and you can download a tile (which contains typically a few hundred buildings). To start, you can practice on the tile where BK-City is located:

9-284-556.city.json

Methodology/workflow to use

You have to use C++ and the CGAL library to do this assignment.

Your code needs to be a single binary/executable that reads one 3DBAG tile in CityJSON, and it will output a new one containing the required extra attributes.

You can use any packages of CGAL except the following functions, which you have to code (these are essential for the assignment and it’s one learning objective to learn how to implement those yourself):

1. Volume

You have to calculate the volume of each building, specifically that of their LoD2.2 geometry.

If \(E\) is the exterior boundary/envelop of a building, then we define its volume by \(Vol(E)\).

You have to implement the method yourself, you are thus not allowed to use an off-the-shelf solution that you find somewhere or the CGAL::volume() functions.

Moreover, we prescribe the method that needs to be used, which is a generalisation of the method that you learned in GEO1002. You need to decompose the solid of the building into tetrahedra, and sum the (signed) volume of each.

Observe that the latest version of the 3DBAG (which you use) already has an attribute b3_volume_lod22; I guess your aim is to verify that those values are correct.

Update: To use this method, you need to have a triangulated outer shell/boundary of the building, but the 3DBAG does not provide triangulated buildings. You therefore have to do this, and this can be done automatically with CGAL, see Triangulate a Polygon Mesh.cpp.

2. General orientation

The general orientation of a GIS polygon is typically defined as the angle of its dominant axis, often calculated as the orientation of the minimum bounding rectangle that best fits the polygon. This angle represents the direction of the polygon’s longest side, and is it is measured in degrees, clockwise, from the North.

3. Area+orientation of the "RoofSurface" surfaces

The surfaces with semantics "RoofSurface" need to have their orientation added as an attribute to the Semantic object, as explained there. There are 9 classes, all stored as a string. If the roof surface is horizontal, then "horizontal" should be put, if not then one of those 8 values:

Also, the surfaces with semantics "RoofSurface" need to have their area added as an attribute to the Semantic object.

4. Geometric difference

To quantify the geometric difference between the LoD1.3 and LoD2.2, you need to calculate the Hausdorff distance.

Notice that the distance between the surface cannot be directly computed, you need to approximate it by sampling points on the surface of the building’s difference LoDs.

Requirements for the program

It should take one argument (the input CityJSON file), and output in the same folder (as the program) a new file called out.city.json.

The demo code for hw02 shows how this can be done. Feel free to use that code and modify it. You can also start from scratch, it’s up to you.

Requirements for the CityJSON output

  1. use CityJSON version 2.0
  2. the file should follow the same structure and have all the original content of the preprocessed input file, eg a "Building" has all of its original attributes and the original LoD2.2 geometries are in the "children" as a "BuildingPart". The only difference allowed is that the order of the properties doesn’t need to be the same since your library might not allow you to have control over this.
  3. the file you produce must be valid according to the CityJSON schema v2.0 (use cjval to verify this).
  4. Be careful about the types and names of the attributes, they are shown below.

You have to add the attributes for each building (and their surfaces) this way:

Some tips

Report

The short report should only discuss, for each of the 4 required attributes, the engineering decisions you took (why did you do it this way or not another way?), and the difficulties/issues you faced and how you solved them. And add a short section who-did-what (we will check the commits also).

We expect a report of about 5 pages max (including figures).

Marking

Criterion Points
report (quality/readability/etc) 2
code works as expected 1
file valid + rules respected 1
volume 1.5
orientation 1.5
RoofSurfaces 1.5
Hausdorff distance 1.5

What to submit and how to submit it

Everything will be done with GitHub. You have to create a private GitHub repository where all the code, output data, and the report go.

Before the deadline, you need to invite @HideBa, @kenohori, and @hugoledoux as collaborators to the repository (how to do this).

After that email me (h.ledoux@tudelft.nl) with (one email per team):

  1. the URL of the repository,
  2. the name and student number of each member.

Do not add or modify anything after the deadline! You will get penalised for late submission.

The structure of your repository should be as follows (if you have more files before submission, just delete them from the final version please):

├── report
│   └── report.pdf 
│   └── (report.tex if used, if you want)
│   └── (report.docx if used, if you want)
├── data
│   └── nextbk_2b.city.json 
│   └── out_9-284-556.city.json 
├── cpp
│   └── src/
│       └── main.cpp
│       └── (others *.cpp or *.h if needed)
│   └── include/
│       └── json.hpp
│   └── CMakeLists.txt (it should work with the code you submitted)
├── README.md

The /data folder contains the output you obtain with your code for the 3DBAG tile 9-284-556

In the README.md, add the name and student number of each of the members.

[last updated: 2025-05-14 07:58]