¿Estás buscando esto?
7.2. Restricted access¶
Another possibility is to restrict access to roads of a certain type by either setting a very high cost for road links with a certain attribute or by not selecting certain road links at all:
UPDATE classes SET cost=100000 WHERE name LIKE 'motorway%';
Through subqueries you can “mix” your costs as you like and this will change the results of your routing request immediately. Cost changes will affect the next shortest path search, and there is no need to rebuild your network.
Of course certain road classes can be excluded in the WHERE clause of the query as well, for example exclude “living_street” class:
SELECT * FROM shortest_path_shooting_star(
'SELECT gid as id, class_id, source, target, length*c.cost as cost,
x1, y1, x2, y2, rule, to_cost, reverse_cost*c.cost as reverse_cost
FROM ways w, classes c
WHERE class_id=c.id AND class_id != 111', 6585, 8247, true, true);
Of course pgRouting allows you all kind of SQL that is possible with PostgreSQL/PostGIS.
Es un fragmento del taller.