I am beginner in this and would like some help with the pgr_astar(pgRouting).
I would like an example in SQL to generate route options using the "pgr_astar " of pgRouting, obstacles avoidance (Points) existing on a particular region of a map extracted roads open streetmap. This road map has been imported into the database with osm2pgrouting.
So far I just can extract the basic, what would be the shortest path to the algorithm as shown in the following example.
SELECT seq, id1 AS node, id2 AS edge, cost FROM pgr_astar('SELECT gid AS id,
source::integer,
target::integer,
length::double precision AS cost,
reverse_cost
x1, y1, x2, y2
FROM ways',
12927,
19932,
true,
false);
But what I need is to avoid Points as car crash, interdicted street, broken bridge, etc .. Could someone give me a guidance how to modify this in SQL above?
The image below shows my difficulty. If there were no obstacle, the shortest path would be the red, but exist is an obstacle (car crash) and so I have to propose another way.