We have a postgis database containing a lot of ordered (by date/time) nautical point (lat/long). Each of these points are affected to a leg between an origin and a destination (both origin and destination are on a coast).

Based on this we are trying to find every possible paths (hopefully only one in most case) for each origin/destination combination (several legs for a given combination), do anyone know if there already exists some sort of algorithm/function that does this ?

EDIT: "affected to a leg" means that we can map every point we have to a combination origin-destination (so for instance we know that Px (-122°, 85°) has been passed by a vessel doing the voyage between origin A and destination B). What we are tying to do is find the possible geographical path between A and B based on the positions we know have been visited by vessels doing this voyage.

  • Can you explain what you mean by "affected to a leg"? It sounds like you might be after a variation of the travelling salesman algorithm but it is difficult to know for sure. It is possible your problem is considerably simpler?
    – winwaed
    Sep 24, 2014 at 16:09
  • Do the points have some kind of vessel ID attached to them Sep 25, 2014 at 10:34
  • Yes they do have a vessel attached to them
    – cp2587
    Sep 25, 2014 at 13:37
  • There was a question about finding routes on the sea couple of months ago but I can't find it right now. Sep 25, 2014 at 18:05

1 Answer 1


It sounds like you want a shortest path algorithm to operate on your PostGIS table of ODs. This is something that pgrouting can do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.