File: trsp-any.test

package info (click to toggle)
pgrouting 2.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 14,232 kB
  • ctags: 1,566
  • sloc: cpp: 74,626; ansic: 6,036; sql: 2,889; sh: 635; perl: 523; makefile: 67
file content (33 lines) | stat: -rw-r--r-- 1,257 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
--              PGR_pgr_trsp
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------


SELECT seq, id1 AS node, id2 AS edge, cost
        FROM pgr_trsp(
                'SELECT id, source, target, cost FROM edge_table',
                7, 12, false, false
        );

CREATE TABLE restrictions (
    rid serial,
    to_cost double precision,
    to_edge integer,
    FROM_edge integer,
    via text
);

INSERT INTO restrictions VALUES (1,100,7,4,null);
INSERT INTO restrictions VALUES (2,4,8,3,5);
INSERT INTO restrictions VALUES (3,100,9,16,null);

   SELECT seq, id1 AS node, id2 AS edge, cost
           FROM pgr_trsp(
                   'SELECT id, source, target, cost FROM edge_table',
                   7, 12, false, false,
                   'SELECT to_cost, to_edge AS target_id,
              FROM_edge || coalesce('','' || via, '''') AS via_path
          FROM restrictions'
           );