I'm trying to find where multiple lines intersect a polygon for two different geodataframes:
from shapely.geometry import Polygon, LineString import geopandas as gpd polygon = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) line1 = LineString([(0.5, 0.5), (0.7, 0.7)]) line2 = LineString([(0.9, 0.9), (0.2, 0.6)]) poly_gdf = gpd.GeoDataFrame(geometry=[polygon]) line_gdf = gpd.GeoDataFrame(geometry=[line1, line2])
This is what the above geodataframes look like (one has a polygon and the other has two lines). It looks to me as if both lines intersect the polygon:
However, the intersect output is very confusing:
Why does the
intersect method give a different output to the standard
I am using Python 3.5.3 and Geopandas 0.2.1 all on Anaconda.