pub fn translate_to_cog(
src: &Path,
dst: &Path,
compression: &str,
overview_resampling: &str,
) -> Result<()>Expand description
Translates an existing GeoTIFF to a Cloud Optimized GeoTIFF.
Uses GDAL’s COG driver in-process via Dataset::create_copy() — equivalent
to rioxarray’s driver="COG" approach. The COG driver handles:
- IFD reordering (overviews before full-res data)
- Ghost area for HTTP range requests
- Tile leader/trailer bytes for parallel HTTP access
- Automatic overview generation via
OVERVIEWS=AUTO
This replaces the previous subprocess-based gdal_translate -of COG which
loaded the entire file into memory (OOM risk for large files).
§Arguments
src- Source GeoTIFF pathdst- Destination COG pathcompression- Compression algorithm, e.g. “LZW”, “DEFLATE”, “ZSTD”overview_resampling- Resampling method for auto-generated overviews