首页 > 代码库 > PostGIS pgrouting

PostGIS pgrouting

alter table roadline add column source integer;
alter table roadline add column target integer;
select pgr_createTopology(‘roadline‘, 0.0001, ‘geom‘, ‘gid‘);

SELECT seq, id1 AS node, id2 AS edge, cost, geom
  FROM pgr_dijkstra(
    ‘SELECT gid as id, source, target, st_length(geom) as cost FROM roadline‘,
    1, 2, false, false
  ) as di
JOIN roadline pt
ON di.id2 = pt.gid ;

PostGIS pgrouting