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
- gdfGeoDataFrame
GeoDataFrame containing objects
- longest_axisstr, list, np.array, pd.Series
the name of the dataframe column,
np.array
, orpd.Series
where is stored longest axis value- areasstr, list, np.array, pd.Series (default None)
the name of the dataframe column,
np.array
, orpd.Series
where is stored area value. If set toNone
, 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
Series containing resulting values
- gdfGeoDataFrame
original GeoDataFrame
- longest_axisSeries
Series containing used longest axis values
- areasSeries
Series containing used area values
-
__init__
(gdf, longest_axis, areas=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(gdf, longest_axis[, areas])Initialize self.