From 389b00796e3de857d7d83474c8c4024d0277a98e Mon Sep 17 00:00:00 2001 From: MaelREBOUX Date: Sat, 8 Jan 2022 17:42:17 +0100 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20la=20distance=20th?= =?UTF-8?q?=C3=A9orique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts_v2/phase_5.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/scripts_v2/phase_5.py b/scripts_v2/phase_5.py index b9259da..49cf6d2 100755 --- a/scripts_v2/phase_5.py +++ b/scripts_v2/phase_5.py @@ -181,9 +181,9 @@ try: #print(" Chargement de la couche phase_5_pk_umap") sql_trunc_load = """ -TRUNCATE TABLE phase_5_pk_umap ; +TRUNCATE TABLE phase_5_pk_umap ; INSERT INTO phase_5_pk_umap -SELECT pk_id, secteur_id, st_transform(the_geom, 2154) +SELECT pk_id, secteur_id, st_transform(the_geom, 2154) FROM phase_5_pk_umap_4326 ORDER BY pk_id ;""" @@ -354,6 +354,27 @@ WHERE phase_5_pk.pk_id = pk_recales.pk_id ;""" # + print(" Mise à jour de la distance théorique") + + sql_update_length_theorical = f""" + UPDATE phase_5_pk + SET + length_theorical = sub.length_theorical + FROM ( + SELECT + pk.pk_id + ,pk.secteur_id + ,s.longueur_km_redadeg AS length_theorical + FROM phase_5_pk pk JOIN secteur s ON pk.secteur_id = s.id + ORDER BY pk_id + ) sub + WHERE phase_5_pk.pk_id = sub.pk_id ;""" + + db_redadeg_cursor.execute(sql_update_length_theorical) + print(" fait") + + # + print(" Mise à jour des informations sur les voies") sql_update_infos_ways = f"""