cartagen.amalgamate_buildings_morphological

cartagen.amalgamate_buildings_morphological#

amalgamate_buildings_morphological(buildings, buffer, edge_length, threshold=0.2)#

Amalgamate buildings using dilation and erosion.

The amalgamation algorithm proposed by Damen et al. [1] is based on morphological dilations and erosions with a square cap. It is particularly useful to keep the overall shape of building blocks.

Parameters:
  • buildings (list of Polygon) – Buildings to amalgamate.

  • buffer (float) – Size of the buffer used for dilation (in meters). Buildings closer than 2 times the buffer size are amalgamated.

  • edge_length (float) – Minimum length of edges in the amalgamated geometries (a simplification process is carried out).

  • threshold (float, optional) – The threshold used for the Douglas-Peucker simplification of the resulting polygon before the edge removal. Do not change.

Returns:

list of Polygon

See also

boffet_areas

Calculate urban areas from buildings. Useful for smaller scale maps.

References

Examples

>>> buildings = [Polygon([(1, 0), (9, 0), (9, 6), (1, 6), (1, 0)]), Polygon([(10, 0), (17, 0), (17, 6), (10, 6), (10, 0)])]
>>> amalgamate_buildings_morphological(buildings, 1.0, 1.0)
<POLYGON ((1.207 1.983, 2.547 5.885, 16.768 4.282, 15.42 0.148, 1.207 1.983))>

(Source code)

../_images/amalgamate_buildings_morphological.png