Skip to content

Commit

Permalink
TMP: update pgsql2shp command
Browse files Browse the repository at this point in the history
  • Loading branch information
leavauchier committed Apr 8, 2024
1 parent 4ab546a commit 20e25ab
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions lidar_prod/tasks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,22 +260,16 @@ def request_bd_uni_for_building_shapefile(
sql_select_list = [sql_batiment, sql_reservoir]
sql_request = sql_territoire + " UNION ".join(sql_select_list)

cmd = [
"pgsql2shp",
"-f",
shapefile_path,
"-h",
bd_params.host,
"-u",
bd_params.user,
"-P",
bd_params.pwd,
bd_params.bd_name,
sql_request,
]
cmd = f"""pgsql2shp -f {shapefile_path} \
-h {bd_params.host} \
-u {bd_params.user} \
-P {bd_params.pwd} \
{bd_params.bd_name} \
{sql_request}"""

# This call may yield
try:
subprocess.check_output(cmd, stderr=subprocess.STDOUT, timeout=120)
subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, timeout=120)
except subprocess.CalledProcessError as e:
# In empty zones, pgsql2shp does not create a shapefile
if (
Expand Down

0 comments on commit 20e25ab

Please sign in to comment.