From cb173bd48c0ddc3b22c0c446a4c11efa551ee3f2 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Mon, 6 May 2024 00:24:32 -0400 Subject: [PATCH] Use export format AUTO for KMZ --- app/raster_utils.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/raster_utils.py b/app/raster_utils.py index 0768dd07c..e363eba81 100644 --- a/app/raster_utils.py +++ b/app/raster_utils.py @@ -51,14 +51,13 @@ def export_raster(input, output, **opts): output_raster = output jpg_background = 255 # white - # KMZ is special, we just export it as PNG with EPSG:4326 + # KMZ is special, we just export it as GeoTIFF # and then call GDAL to tile/package it kmz = export_format == "kmz" if kmz: - export_format = "png" - epsg = 4326 + export_format = "gtiff-rgb" path_base, _ = os.path.splitext(output) - output_raster = path_base + ".png" + output_raster = path_base + ".kmz.tif" if export_format == "jpg": driver = "JPEG" @@ -282,4 +281,4 @@ def write_band(arr, dst, band_num): if kmz: subprocess.check_output(["gdal_translate", "-of", "KMLSUPEROVERLAY", "-co", "Name={}".format(name), - "-co", "FORMAT=PNG", output_raster, output]) + "-co", "FORMAT=AUTO", output_raster, output])