diff --git a/postgis/postgis.sql b/postgis/postgis.sql index ddfe8c8..4c4587a 100644 --- a/postgis/postgis.sql +++ b/postgis/postgis.sql @@ -20,7 +20,7 @@ create index idx_route_geom on route using gist (geom); create or replace function maj_longueur() returns trigger as $$ begin - new.longueur := st_length(new.geom); + new.longueur := st_length(new.geom) * 1000; return new; end; $$ language plpgsql; @@ -48,17 +48,7 @@ create table zone ( -- ************************************************************ -INSERT INTO route (source, target, cost, reverse_cost, geom) -SELECT - a.id AS source, - b.id AS target, - 1 AS cost, - 1 AS reverse_cost, - ST_MakeLine(a.geom, b.geom) AS geom -FROM point a -JOIN point b ON a.id = 6 and b.id = 7; - - \COPY point FROM '/tmp/point.csv' (FORMAT CSV, header, ENCODING 'UTF8'); -\COPY route FROM '/tmp/route.csv' (FORMAT CSV, header, ENCODING 'UTF8'); +\COPY route(id, depart, arrivee, geom) FROM '/tmp/route.csv' (FORMAT CSV, header, ENCODING 'UTF8'); +\COPY route_cout FROM '/tmp/route_cout.csv' (FORMAT CSV, header, ENCODING 'UTF8'); \COPY zone FROM '/tmp/zone.csv' (FORMAT CSV, header, ENCODING 'UTF8');