0

I'm kind of newbie in those spatial matters, but it doesn't seem to be a trivial issue. Let's assume I have data about my city from OSM in my PostGIS database and I want to find the shortest path from point A to point B for a cyclist. The problem is I have to fulfil certain constraints on the path. The thing is, that I have a set of checkpoints located all over the city and the cyclist, during his/her ride from A to B, is supposed to get to one of these checkpoints every 20 minutes (it can be even short, but it must not exceed 20 min limit - avg speed of cyclist = 15 km/h). So I have to find the shortest path that has to cross some of these checkpoints.

I have an idea just to consider the set of checkpoints as a graph (also with points A and B), where ofc only paths between two checkpoints that can be passed through in less then 20 min would be taken into account. Then I would use Dijkstras algorithm to find a solution, but I don't thing it is a good approach. How can I use the power of PostGIS and pgRouting to solve this problem efficiently?

  • It sounds like you want to optimize the order of the checkpoints along the route, is this correct? Then you want to look at using the pgr_tsp function.If you are assuming a constant speed of the average cyclist then compute you edge cost a s something traversal_time = edge_length * speed and I would reduce this to seconds. Then you will need to compute a distance matrix for all the check points, and feed that into pgr_tsp to get the optimized order of the stops, – Stephen Woodbridge Nov 22 '15 at 15:47
  • Sorry, but this is not the TSP problem. The clue is to find the shortest path that means given constraints, not to visit all the check points. – user3691967 Dec 16 '15 at 17:23

0 Answers0