momepy.ShapeIndex#

class momepy.ShapeIndex(gdf, longest_axis, areas=None)[source]#

Calculates the shape index of each object in a given GeoDataFrame.

\[{\sqrt{{area} \over {\pi}}} \over {0.5 * \textit{longest axis}}\]
Parameters:
gdfGeoDataFrame

A GeoDataFrame containing objects.

longest_axisstr, list, np.array, pd.Series

The name of the dataframe column, np.array, or pd.Series where is longest axis 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 stored. If set to None, this function will calculate areas during the process without saving them separately.

Examples

>>> buildings_df['shape_index'] = momepy.ShapeIndex(buildings_df,
...                                                 longest_axis='long_ax',
...                                                 areas='area').series
100%|██████████| 144/144 [00:00<00:00, 5558.33it/s]
>>> buildings_df['shape_index'][0]
0.7564029493781987
Attributes:
seriesSeries

A Series containing resulting values.

gdfGeoDataFrame

The original GeoDataFrame.

longest_axisSeries

A Series containing used longest axis values.

areasSeries

A Series containing used area values.

__init__(gdf, longest_axis, areas=None)[source]#

Methods

__init__(gdf, longest_axis[, areas])