Skip to content

Commit

Permalink
Merge pull request #46 from kartoza/fix-cog-error-log
Browse files Browse the repository at this point in the history
Fix cog error log
  • Loading branch information
danangmassandy committed Jun 10, 2024
2 parents a658bbe + e2af3bf commit 6d0c4df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions django_project/cplus_api/utils/worker_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,20 @@ def create_and_upload_output_layer(
os.path.dirname(file_path),
cog_name
)
subprocess.run(
result = subprocess.run(
(
f"gdal_translate -of COG -co COMPRESS=DEFLATE"
f" {file_path} {final_output_path}"
),
shell=True
shell=True,
capture_output=True
)
if result.returncode != 0:
logger.error(result.stderr)
logger.error(f"Failed coverting raster to COG: {file_path}")
if not os.path.exists(final_output_path):
# fallback to original file
final_output_path = file_path
else:
final_output_path = file_path
output_layer = OutputLayer.objects.create(
Expand Down
2 changes: 1 addition & 1 deletion django_project/version/commit.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a7139ef4365e4db8bcdc9b5eba8d83944d546100
edf56ca2892b5982b80d34a500639bedcfd4ced1

0 comments on commit 6d0c4df

Please sign in to comment.