momepy.Linearity¶
-
class
momepy.
Linearity
(gdf, verbose=True)[source]¶ Calculates linearity of each LineString object in given GeoDataFrame.
\[\frac{l_{euclidean}}{l_{segment}}\]where l is the length of the LineString. MultiLineString returns
np.nan
.Adapted from [AF19].
- Parameters
- gdfGeoDataFrame
GeoDataFrame containing objects
- verbosebool (default True)
if True, shows progress bars in loops and indication of steps
Examples
>>> streets_df['linearity'] = momepy.Linearity(streets_df).series >>> streets_df['linearity'][0] 1.0
- Attributes
- seriesSeries
Series containing mean distance values.
- gdfGeoDataFrame
original GeoDataFrame
Methods
__init__
(gdf[, verbose])Initialize self.