momepy.FractalDimension#
- momepy.FractalDimension(gdf, areas=None, perimeters=None)[source]#
Calculates fractal dimension of each object in given GeoDataFrame.
\[{2log({{perimeter} \over {4}})} \over log(area)\]Based on [McGarigal and Marks, 1995].
- Parameters:
- gdfGeoDataFrame
A GeoDataFrame containing objects.
- areasstr, list, np.array, pd.Series (default None)
The name of the dataframe column,
np.array
, orpd.Series
where area values stored. If set toNone
, this function will calculate areas during the process without saving them separately.- perimetersstr, list, np.array, pd.Series (default None)
The name of the dataframe column,
np.array
, orpd.Series
where perimeter values stored. If set toNone
, this function will calculate perimeters during the process without saving them separately.
- Attributes:
- seriesSeries
A Series containing resulting values.
- gdfGeoDataFrame
The original GeoDataFrame.
- perimetersSeries
A Series containing used perimeter values.
- areasSeries
A Series containing used area values.
Examples
>>> buildings_df['fractal'] = momepy.FractalDimension(buildings_df, ... 'area', ... 'peri').series >>> buildings_df.fractal[0] 1.0726778567038908