préfectures : export CSV
This commit is contained in:
parent
7d1add903a
commit
4e8923e7bc
|
@ -472,7 +472,7 @@ WHERE phase_5_pk.pk_id = pk_recales.pk_id ;"""
|
|||
|
||||
#
|
||||
|
||||
# on finit par l'export geojson pour merour
|
||||
# export geojson pour merour
|
||||
print(" Export geojson pour merour")
|
||||
export_cmd = ["ogr2ogr", "-f", "GeoJSON",
|
||||
f"../data/{millesime}/phase_5_pk.geojson",
|
||||
|
@ -483,6 +483,20 @@ WHERE phase_5_pk.pk_id = pk_recales.pk_id ;"""
|
|||
subprocess.check_output(export_cmd)
|
||||
print(" fait")
|
||||
|
||||
#
|
||||
|
||||
# export CSV liste des voies pour préfectures
|
||||
print(" Export CSV liste des voies pour préfectures")
|
||||
export_cmd = ["ogr2ogr", "-f", "CSV",
|
||||
f"../data/{millesime}/phase_5_prefecture_liste.csv",
|
||||
f"PG:host={db_redadeg_host} port={db_redadeg_port} user={db_redadeg_user} password={db_redadeg_passwd} dbname={db_redadeg_db}",
|
||||
"-sql", "SELECT * FROM phase_5_prefecture_liste ORDER BY pk_id ;",
|
||||
"-lco", "SEPARATOR=SEMICOLON"]
|
||||
# on exporte
|
||||
subprocess.check_output(export_cmd)
|
||||
print(" fait")
|
||||
|
||||
#
|
||||
|
||||
print("")
|
||||
print("")
|
||||
|
|
|
@ -837,8 +837,25 @@ ALTER TABLE phase_5_pk OWNER TO redadeg;
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
|
||||
phase 5 : export préfectures
|
||||
|
||||
==========================================================================
|
||||
*/
|
||||
|
||||
DROP VIEW IF EXISTS phase_5_prefecture_liste ;
|
||||
CREATE VIEW phase_5_prefecture_liste AS
|
||||
SELECT
|
||||
pk_id
|
||||
, substring(municipality_admincode,1,2) AS dpt
|
||||
, municipality_admincode AS comm_insee
|
||||
, municipality_name_fr AS comm_nom
|
||||
, way_ref AS voie_ref
|
||||
, way_name_fr AS voie_nom
|
||||
FROM phase_5_pk pp
|
||||
ORDER BY pk_id ;
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue