tronçons ordonnés et numérotés

This commit is contained in:
MaelReboux 2019-01-03 22:56:04 +01:00
parent b5d23ce807
commit a43da6552a
2 changed files with 9 additions and 4 deletions

View file

@ -35,11 +35,11 @@ CREATE TABLE phase_1_pk_vip_3948
-- table des tronçons créés à partir des longs tracés -- table des tronçons créés à partir des longs tracés
DROP TABLE phase_1_trace_troncons_3948 ; DROP TABLE phase_1_trace_troncons_3948 CASCADE ;
CREATE TABLE phase_1_trace_troncons_3948 CREATE TABLE phase_1_trace_troncons_3948
( (
uid bigint, uid bigint,
secteur character varying(25), secteur int,
km bigint, km bigint,
km_reel bigint, km_reel bigint,
longueur integer, longueur integer,

View file

@ -29,7 +29,7 @@ TRUNCATE phase_1_trace_troncons_3948 ;
INSERT INTO phase_1_trace_troncons_3948 INSERT INTO phase_1_trace_troncons_3948
SELECT SELECT
row_number() over() as uid, row_number() over() as uid,
NULL AS secteur, secteur,
NULL AS km, NULL AS km,
NULL AS km_reel, NULL AS km_reel,
NULL AS longueur, NULL AS longueur,
@ -41,12 +41,17 @@ INSERT INTO phase_1_trace_troncons_3948
FROM FROM
(SELECT (SELECT
ogc_fid, ogc_fid,
secteur,
ordre,
ST_LineMerge(the_geom)::geometry(LineString,3948) AS the_geom, ST_LineMerge(the_geom)::geometry(LineString,3948) AS the_geom,
ST_Length(the_geom) As length ST_Length(the_geom) As length
FROM phase_1_trace_3948 FROM phase_1_trace_3948
-- ce tri est le plus important
ORDER BY secteur ASC, ordre ASC
) AS t ) AS t
CROSS JOIN generate_series(0,10000) AS n CROSS JOIN generate_series(0,10000) AS n
WHERE n*940.00/length < 1 ; WHERE n*940.00/length < 1
ORDER BY t.secteur ASC, t.ordre ASC ;
-- mise à jour des attributs -- mise à jour des attributs
UPDATE phase_1_trace_troncons_3948 UPDATE phase_1_trace_troncons_3948