Assignment 2-resit
Enriching the 3D BAG with building metrics
Deadline is 21 June 2024 at 09:00 am
Late submission? 10% will be removed for each day that you are late.
The assignment is worth 20% of your final mark.
- Overview
- Your code should be able to read any 3D BAG file as input
- Methodology/workflow to use
- Report
- Marking
- What to submit and how to submit it
Overview
In its current form, the 3DBAG dataset contains for each of the 10M buildings in the Netherlands:
- the 3D geometry at three LoDs: 1.2+1.3+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 3D building metrics to derive extra attributes, and to add them to the file. Those are described in the article 3D building metrics for urban morphology, where it is described how they are useful in practice. The metrics are a generalisation of the indicators that can be calculated in 2D by momepy (a nice library for urban morphology, you should check it).
For this assignment, you will need to calculate the following five (for the LoD2.2 geometries only):
- volume
- convexity
- area+orientation of the
"RoofSurface"
surfaces
The updated model must be delivered in the CityJSON format.
Your code should be able to read any 3D BAG file as input
The 3D BAG, developed by the 3D geoinformation group at TU Delft and further explained in Lesson 4.2, is a dataset containing 3D models of all the buildings in the Netherlands. The 3D BAG 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 3D BAG is updated regularly, keeping it up-to-date with the latest openly available building stock and elevation information. More details about the 3D BAG are available on its website.
The 10M buildings are tiled, 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:
3dbag_v210908_fd2cee53_5910.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 (preprocessed, see next step) 3DBAG tile in CityJSON, and it will output a new one containing the required extra metrics and 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):
Preprocessing of the 3DBAG file
The 3D BAG files contain many LoDs, but we want to keep only LoD2.2. This can be performed with cjio with one command:
cjio 9-256-600.city.json vertices_clean lod_filter 2.2 save myfile.city.json
You then obtain a file myfile.city.json
that is cleaned (duplicate vertices have been removed), and it only contains LoD2.2.
You can visualise that file using ninja.cityjson.org, QGIS (using the CityJSON Loader plugin), or azul (macOS only).
Volume
You have to calculate the volume of each building (specifically 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.
Convexity
“It measures the volume deviation between a polyhedron and its convex hull. Thus, it reveals a building’s degree of being curved inward or outward.”
\[CNV(E) = \frac{Vol(E)}{Vol(CH(E))}\]where \(CH(E)\) is the convex hull of \(E\).
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.
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.
Requirements for the CityJSON output
- use CityJSON version 2.0
- the file should follow the same structure and have all the original content of the preprocessed input file (the one you cleaned with the
cjio
command above), 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. - only the LoD2.2 should be present, the other LoDs (0, 1.2, and 1.3) should be deleted
- the file you produce must be valid according to the schema (use
cjval
to verify this). - 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 (ignore proximity):
Some tips
- You need to consider that the buildings in a 3D city model will rarely be geometrically valid (they seldom are in practice), and you cannot assume so. So, your algorithms must deal with this (and not crash because of invalid input).
- the CityJSON file you read as input will be syntactically valid and of version 2.0.
- the validator cjval can be used locally to verify the syntax of the files you create, it’s faster and simpler to use then the web-app.
- you can verify that your area and volume calculations are correct with different tools, but MeshLab is probably the simplest:
Filters / Quality Measure and Computations / Compute Geometric/Topological Measures
. - CGAL has many packages that can be of great help: explore!
Report
The short report should only discuss, for each of the 3 required attributes/metrics, 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.
We expect a report of about 5 pages max (including figures).
Marking
Criterion | Points |
---|---|
report (quality/readability/etc) | 3 |
file valid + rules respected | 1 |
volume | 2 |
convexity | 1 |
orientation | 1.5 |
area | 1.5 |
What to submit and how to submit it
You must hand in one ZIP containing:
- the code (several files possible) you wrote to do the assignment.
- a report in PDF format (not in Microsoft Word please)
with the following structure:
hw02.zip/
|-- src/
|-- main.cpp
|-- definitions.h
|-- geomtools.h
|-- geomtools.cpp
|-- ... (you can add more here)
|-- include/
|-- json.hpp
|-- report/
|-- report.pdf
|-- CMakeList.txt
Submit by email to h.ledoux@tudelft.nl
[last updated: 2024-04-26 13:30]