genthalili / searoute-py

A python package to calculate the shortest sea route between two points on Earth.
Apache License 2.0
63 stars 14 forks source link

return_passages option returns incorrect passages #35

Closed LuciaCam closed 1 week ago

LuciaCam commented 2 weeks ago

Hello,

I have tried to use the return_passages new feature, but it is returning passages that aren't crossed by the maritime path. Here is an example:

import searoute as sr
import geopandas as gpd
import folium

traj = sr.searoute([52.99, 25.01], [-61.87, 17.15], append_orig_dest=True, restrictions=['northwest', 'chili'], return_passages=True)
print(traj['properties']['traversed_passages'])

gdf = gpd.GeoDataFrame.from_features([traj])
gdf = gdf.set_crs("EPSG:4326")
m = folium.Map(location=[0, 0], zoom_start=2)
folium.GeoJson(gdf).add_to(m)
m

The resulting traversed passages are:

['gibraltar', 'panama', 'sunda', 'malacca', 'ormuz', 'chili', 'suez', 'bosporus', 'babalmandab', 'south_africa']

When they should only be:

['gibraltar', 'suez', 'babalmandab', 'ormuz']

Here is a picture of the trajectory: image

Thank you for your help!

genthalili commented 1 week ago

Hi @LuciaCam , true, looks like the the new version is not fixing it. Will commit the new patch soon.

LuciaCam commented 1 week ago

Thanks for the prompt response and fix @genthalili , awesome job!