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
gdfGeoDataFrame

GeoDataFrame containing objects to analyse

valuesstr, list, np.array, pd.Series

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

spatial_weightslibpysal.weight

spatial weights matrix

unique_idstr

name of the column with unique id used as spatial_weights index

areasstr, 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
seriesSeries

Series containing resulting values

gdfGeoDataFrame

original GeoDataFrame

valuesSeries

Series containing used values

swlibpysal.weights

spatial weights matrix

idSeries

Series containing used unique ID

areasSeries

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.