Skip to content

mathias-balmer-novelt-1/building-aggregation-tool

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bldg-agg

Building Aggregation Tools

This repository contains tools/scripts to take as an input building polygons and aggregates them into settlements (a geospatial multipolygon layer).

Module goals:

  • Use only open source tools
  • Less than a day to run
  • Ensure the output are geometrically valid shapes that use linear (not curved) geometries.
  • Ensure all buildings are completely contained by a settlement (ensure no settlements overlap)

Novel-T has developed another tool to help merge nearby settlements to each other. This tool is not included in this repository.

License

This library is released under the GPLv3 License

See https://choosealicense.com/licenses/gpl-3.0/

Two libraries were imported and modified, both under the MIT license:

  1. gdal and gdal sys from https://github.com/georust/gdal
  2. geos and geos sys from https://github.com/georust/geos

Building aggregation rules

Buildings will be put in the same settlement if their extents intersect. This is equivalent to the extents having a horizontal and/or vertical distance of <= the grouping distance. This is controlled by the parameter group-distance, and defaults to 0.000833, which is roughly 70 to 90 meters, depending on the proximity to the equator. Once the buildings are grouped, they are all buffered by 50 meters (can be overridden by the command line argument --buffer-meters). This explains why the resulting multipolygon may have multiple polygons. All polygons are then unioned/dissolved. Finally, any inner rings caused by open areas, such as parks or sports fields, are filled within a settled area. Those polygons are then classified, as described below.

Classification rules

A settlement type field classifies the settlement multi-polygons in either BUA (Built Up Area), SSA (Small Settlement Area), or Hamlet. Below are the classification rules.

BUA

A polygon is a BUA if either of the following conditions are fulfilled:

  1. The polygon intersects >= 3000 buildings
  2. The polygon has population raster values >=13 over an area of >= 400,000m²

SSA

An SSA has >= 50 buildings and is not a BUA

Hamlet

Everything else is a hamlet

Other things to consider

A reference raster is used for various steps. This raster is roughly 90m squares in the 4326 projection. The building aggregation tool buffers building polygons such that settlements match the building outline.

Zonal Stats compatibility

We need to ensure that users get consistent results when doing zonal stats using the settlement geometry. The assumption is the raster aligns with the WorldPop reference grids.

This means if a building centroid is in a raster square and that raster square's center does NOT intersect the settlement shape, the settlement will be expanded. The expansion is done by adding a quarter circular shape. See below to see what this looks like.

Note, this may mean, in certain cases, that 2 settlements that were very close to each other will be merged. Also, certain polygons (as part of multipolygons) might be merged too.

To give an idea of how many settlements are merged, here are some statistics for NGA:

First Header Settlement Count
Before corners 1,416,852
After corners merged 1,408,383
Difference 8,469 (0.6%)

img

Environment

Recommended to use WSL2 or a native linux environment. In windows, docker for windows is required.

Checking out the code

In WSL2, it is recommended to checkout the code in the WSL2 linux file system.

In WSL1, it is recommended to checkout the code in the windows NTFS file system.

To Build Docker Images

For WSL2: Start a WSL prompt

/docker/build.sh

For WSL1: Start a Command Prompt

/docker/bldg-agg-python/build.bat

Setting up the data