I have two geodataframe, gdf1 containing the path
of a bike route and test
containing linestrings of a cycle way :
gdf1 #contains my bike itinerary
>>> index length geometry
0 1562 LINESTRING (2.33273 48.83389, 2.33267 48.83389...
test
>>> insee_com geometry length (meters)
75114 LINESTRING (2.33666 48.83926, 2.33667 48.83929... 39
75114 LINESTRING (2.33665 48.83865, 2.33666 48.83926) 68
75114 LINESTRING (2.33657 48.83969, 2.33658 48.83962) 8
I have mapped those two gdf with plotly express which gives me the following result. We can clearly see the intersection of the two paths :
But I want to have the numerical value of what I see on the map, meaning the length of the intersection of my two paths.
For the moment I tried to use the overlay method but it gives me unexpected results. First it returns me points and multipoints while I was expecting a linestring.
intersection = gpd.overlay(test, gdf1, how = 'intersection', keep_geom_type=False)
intersection.geometry
>>> 0 MULTIPOINT (2.33671 48.83946, 2.33670 48.83940...
1 POINT (2.33666 48.83926)
Name: geometry, dtype: geometry
Second of all, it clearly isn't right on the map...Any help would be really appreciated !