momepy.Tessellation

class momepy.Tessellation(gdf, unique_id, limit, shrink=0.4, segment=0.5, verbose=True)[source]

Generate morphological tessellation around given buildings or proximity bands around given street network.

See [FFRP20] for details of implementation.

Tessellation requires data of relatively high level of precision and there are three particular patterns causign 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.

All three types can be tested prior momepy.Tessellation using momepy.CheckTessellationInput.

Parameters
gdfGeoDataFrame

GeoDataFrame containing building footprints or street network

unique_idstr

name of the column with unique id

limitMultiPolygon or Polygon

MultiPolygon or Polygon defining the study area limiting tessellation (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

Notes

queen_corners is currently experimental method only and can cause errors.

Examples

>>> tess = mm.Tessellation(buildings_df, 'uID', limit=mm.buffered_limit(buildings_df))
Inward offset...
Discretization...
Generating input point array...
100%|██████████| 144/144 [00:00<00:00, 376.15it/s]
Generating Voronoi diagram...
Generating GeoDataFrame...
Vertices to Polygons: 100%|██████████| 33059/33059 [00:01<00:00, 31532.72it/s]
Dissolving Voronoi polygons...
Preparing buffer zone for edge resolving...
Building R-tree...
100%|██████████| 42/42 [00:00<00:00, 752.54it/s]
Cutting...
>>> 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,...
Attributes
tessellationGeoDataFrame

GeoDataFrame containing resulting tessellation

gdfGeoDataFrame

original GeoDataFrame

idSeries

Series containing used unique ID

limitMultiPolygon or Polygon

limit

shrinkfloat

used shrink value

segmentfloat

used segment value

sindexrtree spatial index

spatial index of tessellation

collapsedlist

list of unique_id’s of collapsed features (if there are some)

multipolygonslist

list of unique_id’s of features causing MultiPolygons (if there are some)

Methods

queen_corners(sensitivity)

Experimental function to fix unprecise corners.

__init__(gdf, unique_id, limit, shrink=0.4, segment=0.5, verbose=True)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(gdf, unique_id, limit[, shrink, …])

Initialize self.

queen_corners(sensitivity)

Experimental function to fix unprecise corners.