neatnet.extend_lines#
- neatnet.extend_lines(gdf, tolerance, *, target=None, barrier=None, extension=0)[source]#
Extends lines from
gdfto itself or target within a set tolerance.Extends unjoined ends of LineString segments to join with other segments or target. If
targetis passed, extend lines to target. Otherwise extend lines to itself.If
barrieris passed, each extended line is checked for intersection withbarrier. If they intersect, extended line is not returned. This can be useful if you don’t want to extend street network segments through buildings.- Parameters:
- gdf
geopandas.GeoDataFrame GeoDataFrame containing LineString geometry.
- tolerance
float Tolerance in snapping (by how much could be each segment extended).
- target
None|geopandas.GeoSeries|geopandas.GeoDataFrame Target geometry to which
gdfgets extended. Has to be (Multi)LineString geometry.- barrier
None|geopandas.GeoSeries|geopandas.GeoDataFrame=None Extended line is not used if it intersects barrier.
- extension
int|float= 0 By how much to extend line beyond the snapped geometry. Useful when creating enclosures to avoid floating point imprecision.
- gdf
- Returns:
geopandas.GeoDataFrameGeoDataFrame with extended geometries.