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

Weird bug - length is zero between several points in the arctic #4

Closed bjornasm closed 3 weeks ago

bjornasm commented 1 year ago

I have a set of points in the arctic where sr.searoute says the distance is 0, even though there is considerable between the points. It is almost like there is some kind of silent failure in the program, meaning we end up with 0 for all traits instead of the error message. Interestingly enough the linestring showing the route goes to the same single point for all the points that are failing.

The error persist if I change up origin point and destination.

The origin point: [16.97, 80.856] The destination points:

[30.395, 77.457]
[16.976, 80.856]
[26.756, 72.046]
[28.368, 73.123]
[19.421, 81.142]
[20.996, 79.240]
bjornasm commented 1 year ago

After reading a bit on the source library it seems like this is based on Oak Ridge National Labs CTA Transportation Network Group, Global Shipping Lane Network, World, 2000 - meaning that some areas are not covered by this method. For others like me that are not following the main trade routes (by f.ex researching the arctic) we are left with either adapting the method of computing typical sailing routes using historical AIS data, or finding a new library that uses polygons (land) to show a sailing route. Still, I think this is a great library! Hope the author of this or the source library can update with more coverage.

genthalili commented 1 year ago

hi @bjornasm, thanks for using the package and finding it interesting.

Not sure if I userstand your request, but what I understood from your comments is that you are looking to make some connections on the arctic ocean, it that correct?

If so, then the reason you might find nothing is that the algorithem checks for closes existing node in the network, and returns that specific node and tries to make the connection by looking for the shortest distance.

In your case there is no node close to your input (I assume your inputs are [lat, lon], btw it should be [lon, lat] for this package) as there is no linestring for the arctic ocean : image

Could you try to make a sub-network (for testing), only for the arctic ocean on https://vector.rocks/, then I can try your examples and finaly if everything is as you expect, I can merge your sub-network to the main one of this package.

Thanks!

genthalili commented 3 weeks ago

closing this for now, feel free to re-open if feature is still needed