I have routing working where a user clicks 2 points on the map, I find the closest vertex to those 2 clicked locations and pass that to a pgr_dijkstra function.
What I would like is give the edge a user clicks a dynamically lower cost, which would force the route to go that way, even if there is another route that is the same cost, or maybe even less.
So given this image, a user clicks A & B, the route could go either way, as the length/cost is the same. But since the user clicked the "B" on the left edge, that should be given priority.
Is this possible?
This is my query now:
SELECT id, geom, trailid, cost, reverse_cost, source, target, ST_Reverse(geom) AS flip_geom FROM pgr_dijkstra( 'SELECT id, source::int, target::int, length::float AS cost, reverse_cost::float AS reverse_cost FROM edge_table WHERE ST_Contains(bbox, 4326), geom)', source, target, false, true), edge_table WHERE id2 = id ORDER BY seq;
This is a prime example, I could do either way, but I would prefer to route up the green climbing trail. http://www.trailforks.com/region/vedder-mountain/planner/?waypoints=49.076580,-121.986912:49.070167,-122.000207