neatnet.remove_interstitial_nodes

neatnet.remove_interstitial_nodes#

neatnet.remove_interstitial_nodes(gdf, *, aggfunc='first', **kwargs)[source]#

Clean topology of existing LineString geometry by removal of nodes of degree 2.

Returns the original gdf if there’s no node of degree 2.

Parameters:
gdfgeopandas.GeoSeries | geopandas.GeoDataFrame

Input edgelines process. If any edges are MultiLineString they will be exploded into constituent LineString components.

aggfuncstr | dict = ‘first’

Aggregate function for processing non-spatial component.

**kwargs

Keyword arguments for aggfunc.

Returns:
geopandas.GeoSeries | geopandas.GeoDataFrame

The original input gdf if only 1 edgeline, otherwise the processed edgeline without interstitial nodes.

Notes

Any 3D geometries are (potentially) downcast in loops.