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
|
-- on prend le tracé routé et on fait une version simple
|
||||||
-- 1 ligne par secteur
|
-- 1 ligne par secteur
|
||||||
TRUNCATE TABLE phase_2_trace_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
|
INSERT INTO phase_2_trace_secteur
|
||||||
SELECT
|
SELECT
|
||||||
secteur_id, '', '', 0, 0,
|
secteur_id, '', '', 0, 0,
|
||||||
ST_UNION(the_geom)
|
ST_CollectionExtract(ST_UNION(the_geom),2) AS the_geom
|
||||||
FROM phase_2_trace_pgr
|
FROM trace_ordered
|
||||||
GROUP BY secteur_id
|
GROUP BY secteur_id
|
||||||
ORDER BY secteur_id ;
|
ORDER BY secteur_id ;
|
||||||
|
|
||||||
|
@ -27,36 +32,39 @@ SET
|
||||||
FROM secteur b WHERE a.secteur_id = b.id ;
|
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
|
INSERT INTO phase_2_trace_troncons
|
||||||
SELECT
|
SELECT
|
||||||
row_number() over() as uid,
|
row_number() over() as uid,
|
||||||
-- infos redadeg
|
-- infos redadeg
|
||||||
NULL AS secteur_id,
|
NULL AS secteur_id,
|
||||||
NULL AS ordre,
|
NULL AS km,
|
||||||
NULL AS km,
|
NULL AS km_reel,
|
||||||
NULL AS km_reel,
|
NULL AS longueur,
|
||||||
NULL AS longueur,
|
|
||||||
-- infos OSM
|
-- infos OSM
|
||||||
t.osm_id, t.highway, t.type, t.oneway, t.ref, t.name_fr, t.name_br,
|
--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,
|
ST_LineSubstring(the_geom, 1000.00*n/length,
|
||||||
CASE
|
CASE
|
||||||
WHEN 1000.00*(n+1) < length THEN 1000.00*(n+1)/length
|
WHEN 1000.00*(n+1) < length THEN 1000.00*(n+1)/length
|
||||||
ELSE 1
|
ELSE 1
|
||||||
END) AS the_geom
|
END) AS the_geom
|
||||||
FROM
|
FROM
|
||||||
(SELECT
|
(
|
||||||
id,
|
SELECT
|
||||||
osm_id, highway, "type", oneway, ref, name_fr, name_br,
|
secteur_id, path_seq,
|
||||||
ST_LineMerge(the_geom)::geometry(LineString,2154) AS the_geom,
|
osm_id, highway, "type", oneway, ref, name_fr, name_br,
|
||||||
ST_Length(the_geom) As length
|
ST_LineMerge(the_geom)::geometry(LineString,2154) AS the_geom,
|
||||||
|
ST_Length(the_geom) AS length
|
||||||
FROM phase_2_trace_pgr
|
FROM phase_2_trace_pgr
|
||||||
|
--WHERE secteur_id = 8
|
||||||
|
GROUP BY secteur_id
|
||||||
-- ce tri est le plus important
|
-- ce tri est le plus important
|
||||||
ORDER BY id ASC
|
ORDER BY secteur_id, path_seq ASC
|
||||||
) AS t
|
) AS t
|
||||||
CROSS JOIN generate_series(0,10000) AS n
|
CROSS JOIN generate_series(0,10000) AS n
|
||||||
WHERE n*1000.00/length < 1
|
WHERE n*1000.00/length < 1
|
||||||
ORDER BY t.id ;
|
ORDER BY t.secteur_id, t.path_seq ;
|
||||||
|
|
||||||
-- mise à jour des attributs
|
-- mise à jour des attributs
|
||||||
UPDATE phase_2_trace_troncons
|
UPDATE phase_2_trace_troncons
|
||||||
|
@ -66,7 +74,6 @@ SET
|
||||||
WHEN TRUNC( ST_Length(the_geom)::numeric , 0) = 999 THEN 1000
|
WHEN TRUNC( ST_Length(the_geom)::numeric , 0) = 999 THEN 1000
|
||||||
ELSE TRUNC( ST_Length(the_geom)::numeric , 0)
|
ELSE TRUNC( ST_Length(the_geom)::numeric , 0)
|
||||||
END),
|
END),
|
||||||
km = uid -- km redadeg
|
km = uid -- km redadeg ;
|
||||||
;
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue