momepy.ShapeIndex

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

Calculates shape index of each object in given geoDataFrame.

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

GeoDataFrame containing objects

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

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

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

the name of the dataframe column, np.array, or pd.Series where is stored area value. If set to None, 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:
series : Series

Series containing resulting values

gdf : GeoDataFrame

original GeoDataFrame

longest_axis : Series

Series containing used longest axis values

areas : Series

Series containing used area values

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

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

Methods

__init__(self, gdf, longest_axis[, areas]) Initialize self.