momepy.shape_index¶
-
momepy.shape_index(geometry, longest_axis_length=
None)[source]¶ Calculates the shape index of each object given its geometry.
\[{\sqrt{{area} \over {\pi}}} \over {0.5 * \textit{longest axis}}\]Examples
>>> path = momepy.datasets.get_path("bubenec") >>> buildings = geopandas.read_file(path, layer="buildings") >>> momepy.shape_index(buildings) 0 0.756403 1 0.624834 2 0.767028 3 0.721395 4 0.768958 ... 139 0.750622 140 0.725074 141 0.636296 142 0.728289 143 0.797739 Length: 144, dtype: float64If you know the longest axis length, you can pass it to skip the computation step.
>>> lal = momepy.longest_axis_length(buildings) >>> momepy.shape_index(buildings, longest_axis_length=lal) 0 0.756403 1 0.624834 2 0.767028 3 0.721395 4 0.768958 ... 139 0.750622 140 0.725074 141 0.636296 142 0.728289 143 0.797739 Length: 144, dtype: float64