créa couche phase_2_trace_troncons
This commit is contained in:
parent
9cf14412b0
commit
5a7d474af1
|
@ -40,11 +40,12 @@ echo " Début post-traitements phase 2 pour le secteur $secteur_id"
|
|||
echo ""
|
||||
|
||||
|
||||
echo " création d'une ligne unique par secteur"
|
||||
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
echo " création d'une ligne unique par secteur (phase_2_trace_secteur)"
|
||||
|
||||
|
||||
PGPASSWORD=$DB_PASSWD $PSQL -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -c \
|
||||
"DELETE FROM phase_2_trace_secteur WHERE secteur_id = $secteur_id ;" >> /dev/null
|
||||
"DELETE FROM phase_2_trace_secteur WHERE secteur_id = $secteur_id ;" >> /dev/null
|
||||
|
||||
PGPASSWORD=$DB_PASSWD $PSQL -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -c \
|
||||
"WITH trace_ordered AS (
|
||||
|
@ -56,7 +57,7 @@ PGPASSWORD=$DB_PASSWD $PSQL -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -c \
|
|||
INSERT INTO phase_2_trace_secteur
|
||||
SELECT
|
||||
secteur_id, '', '', 0, 0,
|
||||
ST_CollectionExtract(ST_UNION(the_geom),2) AS the_geom
|
||||
ST_COLLECT(the_geom) AS the_geom
|
||||
FROM trace_ordered
|
||||
GROUP BY secteur_id
|
||||
ORDER BY secteur_id ;" >> /dev/null
|
||||
|
@ -76,11 +77,76 @@ echo " fait"
|
|||
|
||||
|
||||
echo ""
|
||||
echo " Export GeoJSON pour umap"
|
||||
|
||||
|
||||
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
echo " création couche de tronçons ordonnés (phase_2_trace_troncons)"
|
||||
|
||||
PGPASSWORD=$DB_PASSWD $PSQL -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -c \
|
||||
"DELETE FROM phase_2_trace_troncons WHERE secteur_id = $secteur_id ;" >> /dev/null
|
||||
|
||||
PGPASSWORD=$DB_PASSWD $PSQL -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -c \
|
||||
"INSERT INTO phase_2_trace_troncons
|
||||
SELECT
|
||||
row_number() over() as uid,
|
||||
-- infos redadeg
|
||||
$secteur_id AS secteur_id,
|
||||
NULL AS ordre,
|
||||
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
|
||||
FROM
|
||||
(SELECT
|
||||
secteur_id ||'_'|| path_seq AS uid,
|
||||
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 = $secteur_id
|
||||
-- ce tri est le plus important
|
||||
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.uid ;"
|
||||
|
||||
PGPASSWORD=$DB_PASSWD $PSQL -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -c \
|
||||
"UPDATE phase_2_trace_troncons
|
||||
SET
|
||||
longueur =
|
||||
(CASE
|
||||
WHEN TRUNC( ST_Length(the_geom)::numeric , 0) = 999 THEN 1000
|
||||
ELSE TRUNC( ST_Length(the_geom)::numeric , 0)
|
||||
END),
|
||||
km = uid -- km redadeg
|
||||
WHERE secteur_id = $secteur_id;"
|
||||
|
||||
PGPASSWORD=$DB_PASSWD $PSQL -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -c \
|
||||
"VACUUM ANALYZE phase_2_trace_troncons ;"
|
||||
|
||||
echo " fait"
|
||||
|
||||
|
||||
|
||||
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
echo ""
|
||||
echo " Exports GeoJSON pour umap"
|
||||
|
||||
rm -f $rep_data/phase_2_trace_secteur.geojson
|
||||
ogr2ogr -f "GeoJSON" $rep_data/phase_2_trace_secteur.geojson PG:"host=$DB_HOST port=$DB_PORT user=$DB_USER password=$DB_PASSWD dbname=$DB_NAME" phase_2_trace_secteur_4326
|
||||
echo " fait"
|
||||
|
||||
rm -f $rep_data/phase_2_trace_troncons.geojson
|
||||
ogr2ogr -f "GeoJSON" $rep_data/phase_2_trace_troncons.geojson PG:"host=$DB_HOST port=$DB_PORT user=$DB_USER password=$DB_PASSWD dbname=$DB_NAME" phase_2_trace_troncons_4326
|
||||
echo " fait"
|
||||
|
||||
|
||||
echo ""
|
||||
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
||||
|
|
|
@ -41,6 +41,7 @@ def phase_2():
|
|||
subprocess.call(["./phase_2_get_data.sh "+millesime+" "+secteur],shell=True,stderr=subprocess.STDOUT)
|
||||
subprocess.call(["./phase_2_routing_prepare.sh "+millesime+" "+secteur],shell=True,stderr=subprocess.STDOUT)
|
||||
subprocess.call(["./phase_2_routing_compute.sh "+millesime+" "+secteur],shell=True,stderr=subprocess.STDOUT)
|
||||
subprocess.call(["./phase_2_post_traitements.sh "+millesime+" "+secteur],shell=True,stderr=subprocess.STDOUT)
|
||||
|
||||
print("")
|
||||
stopTime = time.perf_counter()
|
||||
|
|
Loading…
Reference in a new issue