Shapely alternative to account for projections

Viewed 9

I am in need of an alternative method for finding if a polygon and linestring overlap. I have previously been using Shapely, but this method does not work for me as it does not account for projections.

For example:

bounded_lons = ([-91.64199014267187, -100.14300892332814, -100.14300892332814, -91.64199014267187])

bounded_lats = ([73.64954029250428, 73.64954029250428, 75.91001987849572, 75.91001987849572])

bounding_polygon2 = Polygon(zip(bounded_lons,bounded_lats))

line = LineString([(-177.875759, 30.00147),(7.250298, 87.987972)])

gdf = gpd.GeoDataFrame(geometry=[bounding_polygon2, line])
gdf.explore(height=300, width=300)

print(line.crosses(bounding_polygon2))

I have found that in both QGIS and folium that when accounting for projections, these overlap (in EPSG:4326). However, as shown in the dataframe, and according to shapely, they do not.

I am therefore looking for an alternative method for finding if a line and polygon overlap, that accounts for projections. I'm not sure where to start.

Thanks

0 Answers
Related