Skip to content

Commit b6fc92b

Browse files
authored
Merge pull request #265 from hancocb/enhancement/revise-cog-conversion
[Enhancement] Revise COG conversion to use gdal_translate and calculate statistics
2 parents 85b6e79 + c7ec3dd commit b6fc92b

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

backend/app/utils/ImageProcessor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def get_info(in_raster: Path) -> dict | NoReturn:
139139
dict: _description_
140140
"""
141141
result: subprocess.CompletedProcess = subprocess.run(
142-
["gdalinfo", "-approx_stats", "-json", in_raster],
142+
["gdalinfo", "-json", in_raster],
143143
stdout=subprocess.PIPE,
144144
check=True,
145145
)
@@ -202,7 +202,7 @@ def convert_to_cog(
202202
project_to_utm: bool,
203203
num_threads: int | None = None,
204204
) -> None:
205-
"""Runs gdalwarp to generate new raster in COG layout.
205+
"""Runs gdal_translate to generate new raster in COG layout.
206206
207207
Args:
208208
in_raster (Path): Path to input raster dataset.
@@ -215,7 +215,7 @@ def convert_to_cog(
215215

216216
# Build the base command
217217
command: List[str] = [
218-
"gdalwarp",
218+
"gdal_translate",
219219
str(in_raster),
220220
str(out_raster),
221221
"-of",
@@ -226,8 +226,8 @@ def convert_to_cog(
226226
f"NUM_THREADS={num_threads}",
227227
"-co",
228228
"BIGTIFF=YES",
229-
"-wm",
230-
"500",
229+
"-co",
230+
"STATISTICS=YES",
231231
]
232232

233233
# Add projection parameters if needed

0 commit comments

Comments
 (0)