momepy.Density

class momepy.Density(gdf, values, spatial_weights, unique_id, areas=None)[source]

Calculate the gross density

\[\frac{\sum \text {values}}{\sum \text {areas}}\]
Parameters:
gdf : GeoDataFrame

GeoDataFrame containing objects to analyse

values : str, list, np.array, pd.Series

the name of the dataframe column, np.array, or pd.Series where is stored character value.

spatial_weights : libpysal.weight

spatial weights matrix

unique_id : str

name of the column with unique id used as spatial_weights index

areas : str, list, np.array, pd.Series (optional)

the name of the dataframe column, np.array, or pd.Series where is stored area value. If None, gdf.geometry.area will be used.

Examples

>>> tessellation_df['floor_area_dens'] = mm.Density(tessellation_df, 'floor_area', sw, 'uID').series
Attributes:
series : Series

Series containing resulting values

gdf : GeoDataFrame

original GeoDataFrame

values : Series

Series containing used values

sw : libpysal.weights

spatial weights matrix

id : Series

Series containing used unique ID

areas : Series

Series containing used area values

References
———
Dibble J, Prelorendjos A, Romice O, et al. (2017) On the origin of spaces: Morphometric foundations of urban form evolution.
Environment and Planning B: Urban Analytics and City Science 46(4): 707–730.
__init__(self, gdf, values, spatial_weights, unique_id, areas=None)[source]

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

Methods

__init__(self, gdf, values, spatial_weights, …) Initialize self.