export GPX : tracé ET PK

This commit is contained in:
MaelREBOUX 2022-02-06 19:40:50 +01:00
parent 788b543012
commit 5a812899e7

View file

@ -524,14 +524,29 @@ WHERE phase_5_pk.pk_id = pk_recales.pk_id ;"""
# #
# export GPX pour qui veut # export GPX du tracé
print(" Export gpx") print(" Export gpx du tracé")
export_cmd = ["ogr2ogr", "-f", "GPX", export_cmd = ["ogr2ogr", "-f", "GPX",
f"../data/{millesime}/gpx/ar_redadeg_{millesime}.gpx", f"../data/{millesime}/gpx/ar_redadeg_{millesime}_trace.gpx",
f"PG:host={db_redadeg_host} port={db_redadeg_port} user={db_redadeg_user} password={db_redadeg_passwd} dbname={db_redadeg_db}", f"PG:host={db_redadeg_host} port={db_redadeg_port} user={db_redadeg_user} password={db_redadeg_passwd} dbname={db_redadeg_db}",
"phase_5_trace", "-sql", "SELECT 'secteur '||secteur_id AS name, ST_Simplify(the_geom, 1.0) FROM phase_5_trace ORDER BY secteur_id",
"-t_srs", "EPSG:4326", "-t_srs", "EPSG:4326",
"-lco", "FORCE_GPX_TRACK=YES"] "-lco", "FORCE_GPX_TRACK=YES",
"-nlt", "linestring"]
# on exporte
subprocess.check_output(export_cmd)
print(" fait")
#
# export GPX des PK
print(" Export gpx des PK")
export_cmd = ["ogr2ogr", "-f", "GPX",
f"../data/{millesime}/gpx/ar_redadeg_{millesime}_pk.gpx",
f"PG:host={db_redadeg_host} port={db_redadeg_port} user={db_redadeg_user} password={db_redadeg_passwd} dbname={db_redadeg_db}",
"-sql", "SELECT pk_id AS name, way_name_fr ||', '||municipality_name_fr AS desc, the_geom FROM phase_5_pk ORDER BY pk_id",
"-t_srs", "EPSG:4326",
"-nlt", "point"]
# on exporte # on exporte
subprocess.check_output(export_cmd) subprocess.check_output(export_cmd)
print(" fait") print(" fait")