· 8 years ago · Feb 22, 2018, 02:30 PM
1
2--CREATE ALIAS IF NOT EXISTS H2GIS_NETWORK FOR "org.h2gis.network.functions.NetworkFunctions.load"; CALL H2GIS_NETWORK();
3--create SPATIAL INDEX ON "GIS.OSM_ROADS_FREE_1" (the_geom);
4--create table routes_vannes as select ST_TRANSFORM(ST_SETSRID(ST_INTERSECTION(a.the_geom, b.the_geom), 4326), 2154) as the_geom, MAXSPEED, PK, fclass from "GIS.OSM_ROADS_FREE_1" as a, FENCE as b where a.the_geom && b.the_geom and ST_INTERSECTS (a.the_geom, b.the_geom);
5-- il y a des multistring donc on explose la couche initiale
6--create table routes_vannes_dec as select * from st_explode ('ROUTES_VANNES')
7-- il faut créer une clé primaire parce qu'on a décomposé la couche et on a besoin d'un identifiant unique avant de lancer la fonction pour le graphe (le PK est obsolète)
8--alter table ROUTEs_VANNES_DEC add column id serial;
9--alter table ROUTEs_VANNES_DEC ADD primary key (id);
10--alter table ROUTEs_VANNES_DEC ALTER COLUMN the_geom LINESTRING