momepy.Volume#

momepy.Volume(gdf, heights, areas=None)[source]#

Calculates the volume of each object in a given GeoDataFrame based on its height and area.

\[area * height\]
Parameters:
gdfGeoDataFrame

A GeoDataFrame containing objects to analyse.

heightsstr, list, np.array, pd.Series

The name of the dataframe column, np.array, or pd.Series where height values are stored.

areasstr, list, np.array, pd.Series (default None)

The name of the dataframe column, np.array, or pd.Series where area values are stored. If set to None, this will calculate areas during the process without saving them separately.

Attributes:
seriesSeries

A Series containing resulting values.

gdfGeoDataFrame

The original GeoDataFrame.

heightsSeries

A Series containing used heights values.

areasGeoDataFrame

A Series containing used areas values.

Examples

>>> buildings['volume'] = momepy.Volume(buildings, heights='height_col').series
>>> buildings.volume[0]
7285.5749470443625
>>> buildings['volume'] = momepy.Volume(buildings, heights='height_col',
...                                     areas='area_col').series
>>> buildings.volume[0]
7285.5749470443625