Python – Sea Distance Calculator, Intermediate Coordinates?

Sea Distance Calculator, Intermediate Coordinates?… here is a solution to the problem.

Sea Distance Calculator, Intermediate Coordinates?

How do you calculate the distance between 2 coordinates at sea? I would also like to be able to draw a route between the two coordinates.

The only solution I’ve found so far is to split the map into pixels, identify each pixel as LAND or SEA, and then try to find the path using the A* algorithm. The pixels are then converted to relative coordinates.

There are some packages that I can buy, but none of them have online extensions. The service that calculates the distance between seaports and plots the path on the map is searates.com

Solution

Note that map distorts distance. For example, in the Mercator projection, segments farther from the equator represent segments closer to the equator that are physically less distant than equal-length. If you just allocate a flat cost for pixels/squares/etc., you end up with non-optimal routes and incorrect distance calculations.

If you project a mesh on a map (a

pixel is just a specific mesh in many possible meshes) and use A* to search for the best path, all you need to do for the search algorithm to work is to set the edge weights to be determined based on actual distances along the surface of the sphere (earth) rather than on the map.

Note that simply saying “at sea or not at sea” is not enough to determine seaworthiness. There are also questions of depth, traffic routes (e.g. shipping that considers the English Channel divided into several lanes) and political considerations (territorial waters, etc.). You also want to manually add routes for channels (Panama, Suez) that are too small to display on the map and adjust their costs to cover any overhead incurred.

Related Problems and Solutions