Skip to main content
6 of 8
deleted 957 characters in body
user32882
  • 3.6k
  • 2
  • 32
  • 71

Intersecting MultiLinestring based geodataframes with geopandas

I would like to perform the following operation using geopandas.

enter image description here

The segments are delimited by red points and the blue items are attribute information. My inputs are the first and second line segments and my output is the third line segment.

Initially I thought this would be an intersection operation, but I soon learned that geopandas can only intersect polygons, therefore something like:

intersection = geopandas.overlay(split_lines, original_lines, how='intersection')

returns the following error:

raise TypeError("overlay only takes GeoDataFrames with (multi)polygon "
TypeError: overlay only takes GeoDataFrames with (multi)polygon

This to me looks like a standard geoprocessing operation and I really hope I won't have to code this up from scratch. Are there any simplified ways to come up with the following result without having to code a custom function?

Thanks

user32882
  • 3.6k
  • 2
  • 32
  • 71