momepy.FractalDimension¶
-
class
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 [McG95].
- Parameters
- gdfGeoDataFrame
GeoDataFrame containing objects
- 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.- perimetersstr, list, np.array, pd.Series (default None)
the name of the dataframe column,
np.array
, orpd.Series
where is stored perimeter value. If set toNone
, function will calculate perimeters during the process without saving them separately.
Examples
>>> buildings_df['fractal'] = momepy.FractalDimension(buildings_df, ... 'area', ... 'peri').series >>> buildings_df.fractal[0] 1.0726778567038908
- Attributes
- seriesSeries
Series containing resulting values
- gdfGeoDataFrame
original GeoDataFrame
- perimetersSeries
Series containing used perimeter values
- areasSeries
Series containing used area values
-
__init__
(gdf, areas=None, perimeters=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(gdf[, areas, perimeters])Initialize self.