Update create_tables.sql

This commit is contained in:
MaelREBOUX 2021-11-05 15:06:05 +01:00
parent 82c9833f20
commit 95b93bd070

View file

@ -579,29 +579,29 @@ CREATE INDEX phase_3_troncons_pgr_geom_idx ON phase_3_troncons_pgr USING gist(th
ALTER TABLE phase_3_troncons_pgr OWNER to redadeg; ALTER TABLE phase_3_troncons_pgr OWNER to redadeg;
DROP TABLE IF EXISTS phase_3_trace_troncons CASCADE ; DROP TABLE IF EXISTS phase_3_troncons CASCADE ;
CREATE TABLE phase_3_trace_troncons CREATE TABLE phase_3_troncons
( (
troncon_id bigint, troncon_id bigint,
secteur_id int, secteur_id int,
the_geom geometry, the_geom geometry,
CONSTRAINT phase_3_trace_troncons_pkey PRIMARY KEY (troncon_id), CONSTRAINT phase_3_troncons_pkey PRIMARY KEY (troncon_id),
--CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'LINESTRING'::text), --CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'LINESTRING'::text),
--CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'LINESTRING'::text OR geometrytype(the_geom) = 'MULTILINESTRING'::text), --CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'LINESTRING'::text OR geometrytype(the_geom) = 'MULTILINESTRING'::text),
CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 2154) CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 2154)
); );
CREATE INDEX phase_3_trace_troncons_geom_idx ON phase_3_trace_troncons USING gist(the_geom); CREATE INDEX phase_3_troncons_geom_idx ON phase_3_trace_troncons USING gist(the_geom);
ALTER TABLE phase_3_trace_troncons OWNER TO redadeg; ALTER TABLE phase_3_troncons OWNER TO redadeg;
-- la même couche en 4326 -- la même couche en 4326
DROP VIEW IF EXISTS phase_3_trace_troncons_4326 ; DROP VIEW IF EXISTS phase_3_troncons_4326 ;
CREATE VIEW phase_3_trace_troncons_4326 AS CREATE VIEW phase_3_troncons_4326 AS
SELECT SELECT
troncon_id, troncon_id,
secteur_id, secteur_id,
ST_Transform(the_geom,4326) AS the_geom ST_Transform(the_geom,4326) AS the_geom
FROM phase_3_trace_troncons ; FROM phase_3_troncons ;
ALTER TABLE phase_3_trace_troncons_4326 OWNER TO redadeg; ALTER TABLE phase_3_troncons_4326 OWNER TO redadeg;
@ -634,7 +634,7 @@ ALTER TABLE phase_3_trace_secteurs_4326 OWNER TO redadeg;
-- la couche des PK calculés automatiquement -- la couche des PK calculés automatiquement
DROP TABLE IF EXISTS phase_3_pk_auto CASCADE ; DROP TABLE IF EXISTS phase_3_pk CASCADE ;
CREATE TABLE phase_3_pk_auto CREATE TABLE phase_3_pk_auto
( (
pk_id integer, pk_id integer,
@ -657,17 +657,17 @@ CREATE TABLE phase_3_pk_auto
way_name_fr text, way_name_fr text,
way_name_br text, way_name_br text,
the_geom geometry, the_geom geometry,
CONSTRAINT phase_3_pk_auto_pkey PRIMARY KEY (pk_id), CONSTRAINT phase_3_pk_pkey PRIMARY KEY (pk_id),
CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'POINT'::text), CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'POINT'::text),
CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 2154) CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 2154)
) ; ) ;
CREATE INDEX phase_3_pk_auto_geom_idx ON phase_3_pk_auto USING gist(the_geom); CREATE INDEX phase_3_pk_geom_idx ON phase_3_pk USING gist(the_geom);
ALTER TABLE phase_3_pk_auto OWNER TO redadeg; ALTER TABLE phase_3_pk OWNER TO redadeg;
-- la même couche en 4326 -- la même couche en 4326
DROP VIEW IF EXISTS phase_3_pk_auto_4326 ; DROP VIEW IF EXISTS phase_3_pk_4326 ;
CREATE VIEW phase_3_pk_auto_4326 AS CREATE VIEW phase_3_pk_4326 AS
SELECT SELECT
pk_id, pk_id,
pk_x, pk_y, pk_long, pk_lat, pk_x, pk_y, pk_long, pk_lat,
@ -678,8 +678,8 @@ CREATE VIEW phase_3_pk_auto_4326 AS
way_osm_id, way_highway, way_type, way_oneway, way_ref, way_osm_id, way_highway, way_type, way_oneway, way_ref,
way_name_fr, way_name_br, way_name_fr, way_name_br,
ST_Transform(the_geom,4326)::geometry(Point, 4326) AS the_geom ST_Transform(the_geom,4326)::geometry(Point, 4326) AS the_geom
FROM phase_3_pk_auto ; FROM phase_3_pk ;
ALTER TABLE phase_3_pk_auto_4326 OWNER TO redadeg; ALTER TABLE phase_3_pk_4326 OWNER TO redadeg;
-- couche de lignes simples directes de PK à PK -- couche de lignes simples directes de PK à PK