From a43da6552aa7eedadcf2b8c515c698ffd7322de8 Mon Sep 17 00:00:00 2001 From: MaelReboux Date: Thu, 3 Jan 2019 22:56:04 +0100 Subject: [PATCH] =?UTF-8?q?tron=C3=A7ons=20ordonn=C3=A9s=20et=20num=C3=A9r?= =?UTF-8?q?ot=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- create_tables_3948.sql | 4 ++-- load_tables_3948.sql | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/create_tables_3948.sql b/create_tables_3948.sql index 50a3588..d9d587f 100644 --- a/create_tables_3948.sql +++ b/create_tables_3948.sql @@ -35,11 +35,11 @@ CREATE TABLE phase_1_pk_vip_3948 -- 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 ( uid bigint, - secteur character varying(25), + secteur int, km bigint, km_reel bigint, longueur integer, diff --git a/load_tables_3948.sql b/load_tables_3948.sql index 813077d..30a74b6 100644 --- a/load_tables_3948.sql +++ b/load_tables_3948.sql @@ -29,7 +29,7 @@ TRUNCATE phase_1_trace_troncons_3948 ; INSERT INTO phase_1_trace_troncons_3948 SELECT row_number() over() as uid, - NULL AS secteur, + secteur, NULL AS km, NULL AS km_reel, NULL AS longueur, @@ -41,12 +41,17 @@ INSERT INTO phase_1_trace_troncons_3948 FROM (SELECT ogc_fid, + secteur, + ordre, ST_LineMerge(the_geom)::geometry(LineString,3948) AS the_geom, ST_Length(the_geom) As length FROM phase_1_trace_3948 + -- ce tri est le plus important + ORDER BY secteur ASC, ordre ASC ) AS t 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 UPDATE phase_1_trace_troncons_3948