Skip to content

Polygons

Ivan Pađen edited this page Jul 31, 2024 · 14 revisions

The requirements for polygons are the following:

  • Polygons must be in one of GDAL-supported formats
  • Individual polygons should be valid (Section 2 of this publication). You might get warning messages and bad results with invalid polygons (garbage in-garbage out)
  • Building footprints have to form a planar partition, i.e. they should not overlap

In case your polygons do not meet the criteria, we suggest you use QGIS for preparation. It is open-source and contains most functionalities you require to prepare the data. Alternatively, you can look into prepair and pprepair for repair of non-valid polygons and planar partitions, respectively.

You might have to adjust the Coordinate Reference System (CRS) to get a better representation of your polygons. Especially in the case when a point cloud is present, you should compare whether polygons and the point cloud are using the same CRS.

Polygon generalisation

In case you would like to make your urban scenario simpler, you can use our polyprep tool (located here in the repo) for some simple operations.

The tool can merge polygons that are close within a certain threshold (buffer size), remove holes, simplify polygon lines using the Ramer–Douglas–Peucker simplification algorithm. If the polygons are merged, it transfers the properties of a polygon with a largest area.

To install the tool, install the requirements listed in /tools/polyprep folder of the repo:

pip install -r requirements.txt

Do not forget to use a virtual environment.

Use the tool as follows:

python polyprep.py input_geojson output_geojson buffer_size --optional_arg

Example outputs:

python polyprep.py intput.geojson simplified.geojson 1.0 --simplify_tol 0.1

polyprep_1

python polyprep.py intput.geojson simplified.geojson 1.0 --remove_holes 2 --simplify_tol 0.1

polyprep_2

The list of arguments is as follows:

buffer_size: distance by which all the polygons are inflated before merging.

--remove_holes: 0, 1, or 2; 0 - no removal, 1 - removes holes before merging, 2 - removes additional holes that might be created by merging

--simplify_tol: float, suggestion: start with 0.1 and increase by 0.2 to 0.5; it's a tolerance parameter of the Ramer–Douglas–Peucker simplification algorithm.

--convex_hull: this argument extracts the convex hull of every building polygon, additionally simplifying the urban scenario.

Please note that polygon simplification can result in an undefined behaviour of LoD2.2 and LoD1.3 reconstruction.

(back to top)

Polygon splitting and merging

Below you can find some information on handling polygons in QGIS. If you are just getting started, check some of the beginner tutorials.

Polygon splitting can be used to aid reconstruction when there are considerable height differences in a single polygon. Take for example this building, its polygon, and the LoD1.2 reconstruction of the building.

ewi

One polygon contains the whole building footprint, hence LoD1.2 reconstruction will result in a model that is not accurate. By splitting the polygon, you can get a better representation of reality.

sliced

sliced_reconstructed

Polygon merging can be beneficial when using flat polygons, e.g. water. Merging polygons ensures there is no abrupt jump in height at their border

merged

(back to top)

Polygon simplification

QGIS contains several simplification algorithms you can use for footprint simplification. Check the figure below on where to find them.

simplified

(back to top)

Creating a polygon for influence region/domain boundary

You can use create polygon tool in QGIS in case you would like to manually define influence region/domain extent. First, you need to create a new layer by selecting LayerCreate New LayerNew Temporary Scratch Layer and selecting Polygon as the Geometry type.

merged

To confirm your selection, click the right mouse button. In the end, you can just export the polygon to any format (e.g. GeoJSON). Make sure to export influence region/domain boundary polygons in the same CRS as the buildings and the point cloud.

export

(back to top)