- momepy.preprocess(buildings, size=30, compactness=0.2, islands=True, loops=2, verbose=True)#
Preprocesses building geometry to eliminate additional structures being single features.
Certain data providers (e.g. Ordnance Survey in GB) do not provide building geometry as one feature, but divided into different features depending their level (if they are on ground floor or not - passages, overhangs). Ideally, these features should share one building ID on which they could be dissolved. If this is not the case, series of steps needs to be done to minimize errors in morphological analysis.
This script attempts to preprocess such geometry based on several condidions: If feature area is smaller than set size it will be a) deleted if it does not touch any other feature; b) will be joined to feature with which it shares the longest boundary. If feature is fully within other feature, these will be joined. If feature’s circular compactness (
momepy.CircularCompactness) is < 0.2, it will be joined to feature with which it shares the longest boundary. Function does multiple loops through.
geopandas.GeoDataFrame containing building layer
- sizefloat (default 30)
maximum area of feature to be considered as additional structure. Set to None if not wanted.
- compactnessfloat (default .2)
if set, function will resolve additional structures identified based on their circular compactness.
- islandsbool (default True)
if True, function will resolve additional structures which are fully within other structures (share 100% of exterior boundary).
- loopsint (default 2)
number of loops
- verbosebool (default True)
if True, shows progress bars in loops and indication of steps
GeoDataFrame containing preprocessed geometry