- class momepy.Tessellation(gdf, unique_id, limit=None, shrink=0.4, segment=0.5, verbose=True, enclosures=None, enclosure_id='eID', threshold=0.05, use_dask=True, n_chunks=None, **kwargs)#
Three versions of tessellation can be created:
Morphological tessellation around given buildings
Proximity bands around given street network
Enclosed tessellation based on given buildings
limitto create morphological tessellation or proximity bands or
enclosuresto create enclosed tessellation.
Tessellation requires data of relatively high level of precision and there are three particular patterns causing issues.
1. Features will collapse into empty polygon - these do not have tessellation cell in the end.
2. Features will split into MultiPolygon - at some cases, features with narrow links between parts split into two during ‘shrinking’. In most cases that is not an issue and resulting tessellation is correct anyway, but sometimes this result in a cell being MultiPolygon, which is not correct.
3. Overlapping features - features which overlap even after ‘shrinking’ cause invalid tessellation geometry.
GeoDataFrame containing building footprints or street network
name of the column with unique id
- limitMultiPolygon or Polygon (default None)
MultiPolygon or Polygon defining the study area limiting morphological tessellation or proximity bands (otherwise it could go to infinity).
- shrinkfloat (default 0.4)
distance for negative buffer to generate space between adjacent polygons (if geometry type of gdf is (Multi)Polygon).
- segmentfloat (default 0.5)
maximum distance between points after discretization
- verbosebool (default True)
if True, shows progress bars in loops and indication of steps
- enclosuresGeoDataFrame (default None)
Enclosures geometry. Can be generated using
- enclosure_idstr (default ‘eID’)
name of the enclosure_id containing unique identifer for each row in
enclosures. Applies only if
- thresholdfloat (default 0.05)
The minimum threshold for a building to be considered within an enclosure. Threshold is a ratio of building area which needs to be within an enclosure to inlude it in the tessellation of that enclosure. Resolves sliver geometry issues. Applies only if
- use_daskbool (default True)
Use parallelised algorithm based on
dask.dataframe. Requires dask. Applies only if
Number of chunks to be used in parallelization. Ideal is one chunk per thread. Applies only if
enclosuresare passed. Defualt automatically uses n == dask.system.cpu_count.
>>> tess = mm.Tessellation( ... buildings_df, 'uID', limit=mm.buffered_limit(buildings_df) ... ) Inward offset... Generating input point array... Generating Voronoi diagram... Generating GeoDataFrame... Dissolving Voronoi polygons... >>> tess.tessellation.head() uID geometry 0 1 POLYGON ((1603586.677274485 6464344.667944215,... 1 2 POLYGON ((1603048.399497852 6464176.180701573,... 2 3 POLYGON ((1603071.342637536 6464158.863329805,... 3 4 POLYGON ((1603055.834005827 6464093.614718676,... 4 5 POLYGON ((1603106.417554705 6464130.215958447,...
>>> enclosures = mm.enclosures(streets, admin_boundary, [railway, rivers]) >>> encl_tess = mm.Tessellation( ... buildings_df, 'uID', enclosures=enclosures ... ) >>> encl_tess.tessellation.head() uID geometry eID 0 109.0 POLYGON ((1603369.789 6464340.661, 1603368.754... 0 1 110.0 POLYGON ((1603368.754 6464340.097, 1603369.789... 0 2 111.0 POLYGON ((1603458.666 6464332.614, 1603458.332... 0 3 112.0 POLYGON ((1603462.235 6464285.609, 1603454.795... 0 4 113.0 POLYGON ((1603524.561 6464388.609, 1603532.241... 0
GeoDataFrame containing resulting tessellation
- For enclosed tessellation, gdf contains three columns:
unique_idmatching with parental building,
enclosure_idmatching with enclosure integer index
Series containing used unique ID
- limitMultiPolygon or Polygon
used shrink value
used segment value
list of unique_id’s of collapsed features (if there are some) Applies only if
list of unique_id’s of features causing MultiPolygons (if there are some) Applies only if
- __init__(gdf, unique_id, limit=None, shrink=0.4, segment=0.5, verbose=True, enclosures=None, enclosure_id='eID', threshold=0.05, use_dask=True, n_chunks=None, **kwargs)#
__init__(gdf, unique_id[, limit, shrink, ...])