line_merge#
- line_merge(lines: GeoDataFrame, **kwargs) GeoDataFrame [source]#
shapely.line_merge
algorithm applied to a GeoDataFrame.See the corresponding documentation for more insights about the details of this function.
- Parameters:
lines (gpd.GeoDataFrame) – MultiLineString as a GeoDataFrame.
- Returns:
GeoDataFrame composed of (Multi)LineStrings formed by combining the lines of the input GeoDataFrame
- Return type:
gpd.GeoDataFrame
Example
>>> import geopandas as gpd >>> from sertit import geometry >>> lines = gpd.read("my_lines.shp") >>> poly = gpd.read("my_poly.shp") geometry 0 POLYGON ((491460.248 5616687.073, 491460.248 5... >>> geometry.split(poly, splitter=lines) The lines are discontinuous and don't intersect totally the input polygon: nothing is splitted geometry 0 POLYGON ((491460.248 5616687.073, 491460.248 5...
>>> lines = geometry.line_merge(lines) >>> geometry.split(poly, splitter=lines) The lines are now merged into one and now intersect totally the input polygon: split is done geometry 0 POLYGON ((491460.248 5616687.073, 491460.248 5... 0 POLYGON ((491055.017 5616255.823, 491053.998 5...