maj couche trace_secteur
This commit is contained in:
parent
b197baa147
commit
8034a6374f
|
@ -312,6 +312,17 @@ ALTER TABLE phase_2_trace_secteur_4326 OWNER to redadeg;
|
|||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS phase_2_trace_trous ;
|
||||
CREATE TABLE phase_2_trace_trous
|
||||
(
|
||||
id serial,
|
||||
secteur_id int,
|
||||
the_geom geometry,
|
||||
CONSTRAINT phase_2_trace_trous_pkid PRIMARY KEY (id),
|
||||
CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'POINT'::text),
|
||||
CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 2154)
|
||||
);
|
||||
ALTER TABLE phase_2_trace_trous OWNER to redadeg;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -9,11 +9,16 @@
|
|||
-- on prend le tracé routé et on fait une version simple
|
||||
-- 1 ligne par secteur
|
||||
TRUNCATE TABLE phase_2_trace_secteur ;
|
||||
WITH trace_ordered AS (
|
||||
SELECT secteur_id, the_geom
|
||||
FROM phase_2_trace_pgr
|
||||
ORDER BY secteur_id, path_seq
|
||||
)
|
||||
INSERT INTO phase_2_trace_secteur
|
||||
SELECT
|
||||
secteur_id, '', '', 0, 0,
|
||||
ST_UNION(the_geom)
|
||||
FROM phase_2_trace_pgr
|
||||
ST_CollectionExtract(ST_UNION(the_geom),2) AS the_geom
|
||||
FROM trace_ordered
|
||||
GROUP BY secteur_id
|
||||
ORDER BY secteur_id ;
|
||||
|
||||
|
@ -27,36 +32,39 @@ SET
|
|||
FROM secteur b WHERE a.secteur_id = b.id ;
|
||||
|
||||
|
||||
/*TRUNCATE phase_2_trace_troncons ;
|
||||
/*
|
||||
TRUNCATE phase_2_trace_troncons ;
|
||||
INSERT INTO phase_2_trace_troncons
|
||||
SELECT
|
||||
row_number() over() as uid,
|
||||
-- infos redadeg
|
||||
row_number() over() as uid,
|
||||
-- infos redadeg
|
||||
NULL AS secteur_id,
|
||||
NULL AS ordre,
|
||||
NULL AS km,
|
||||
NULL AS km_reel,
|
||||
NULL AS longueur,
|
||||
NULL AS km,
|
||||
NULL AS km_reel,
|
||||
NULL AS longueur,
|
||||
-- infos OSM
|
||||
t.osm_id, t.highway, t.type, t.oneway, t.ref, t.name_fr, t.name_br,
|
||||
ST_LineSubstring(the_geom, 1000.00*n/length,
|
||||
CASE
|
||||
WHEN 1000.00*(n+1) < length THEN 1000.00*(n+1)/length
|
||||
ELSE 1
|
||||
END) AS the_geom
|
||||
--t.osm_id, t.highway, t.type, t.oneway, t.ref, t.name_fr, t.name_br,
|
||||
ST_LineSubstring(the_geom, 1000.00*n/length,
|
||||
CASE
|
||||
WHEN 1000.00*(n+1) < length THEN 1000.00*(n+1)/length
|
||||
ELSE 1
|
||||
END) AS the_geom
|
||||
FROM
|
||||
(SELECT
|
||||
id,
|
||||
osm_id, highway, "type", oneway, ref, name_fr, name_br,
|
||||
ST_LineMerge(the_geom)::geometry(LineString,2154) AS the_geom,
|
||||
ST_Length(the_geom) As length
|
||||
(
|
||||
SELECT
|
||||
secteur_id, path_seq,
|
||||
osm_id, highway, "type", oneway, ref, name_fr, name_br,
|
||||
ST_LineMerge(the_geom)::geometry(LineString,2154) AS the_geom,
|
||||
ST_Length(the_geom) AS length
|
||||
FROM phase_2_trace_pgr
|
||||
--WHERE secteur_id = 8
|
||||
GROUP BY secteur_id
|
||||
-- ce tri est le plus important
|
||||
ORDER BY id ASC
|
||||
) AS t
|
||||
ORDER BY secteur_id, path_seq ASC
|
||||
) AS t
|
||||
CROSS JOIN generate_series(0,10000) AS n
|
||||
WHERE n*1000.00/length < 1
|
||||
ORDER BY t.id ;
|
||||
ORDER BY t.secteur_id, t.path_seq ;
|
||||
|
||||
-- mise à jour des attributs
|
||||
UPDATE phase_2_trace_troncons
|
||||
|
@ -66,7 +74,6 @@ SET
|
|||
WHEN TRUNC( ST_Length(the_geom)::numeric , 0) = 999 THEN 1000
|
||||
ELSE TRUNC( ST_Length(the_geom)::numeric , 0)
|
||||
END),
|
||||
km = uid -- km redadeg
|
||||
;
|
||||
km = uid -- km redadeg ;
|
||||
*/
|
||||
|
||||
|
|
Loading…
Reference in a new issue