HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

gdal_translate — Convert raster data between different formats. More information: <https://gdal.org/en/stable/program

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandgdal_translatebetweenconvertclirasterdatadifferent

Problem

How to use the gdal_translate command: Convert raster data between different formats. More information: <https://gdal.org/en/stable/programs/gdal_translate.html>.

Solution

gdal_translate — Convert raster data between different formats. More information: <https://gdal.org/en/stable/programs/gdal_translate.html>.

Convert a raster dataset to JPEG format:
gdal_translate -of {{JPEG}} {{path/to/input.tif}} {{path/to/output.jpeg}}


Assign a projection to a raster dataset:
gdal_translate -a_srs {{EPSG:4326}} {{path/to/input.tif}} {{path/to/output.tif}}


Reduce the size of a raster dataset to a specific fraction:
gdal_translate -outsize {{40%}} {{40%}} {{path/to/input.tif}} {{path/to/output.tif}}


Convert a GeoTiff to a Cloud Optimized GeoTiff:
gdal_translate {{path/to/input.tif}} {{path/to/output.tif}} -of COG -co COMPRESS=LZW

Code Snippets

Convert a raster dataset to JPEG format

gdal_translate -of {{JPEG}} {{path/to/input.tif}} {{path/to/output.jpeg}}

Assign a projection to a raster dataset

gdal_translate -a_srs {{EPSG:4326}} {{path/to/input.tif}} {{path/to/output.tif}}

Reduce the size of a raster dataset to a specific fraction

gdal_translate -outsize {{40%}} {{40%}} {{path/to/input.tif}} {{path/to/output.tif}}

Convert a GeoTiff to a Cloud Optimized GeoTiff

gdal_translate {{path/to/input.tif}} {{path/to/output.tif}} -of COG -co COMPRESS=LZW

Context

tldr-pages: common/gdal_translate

Revisions (0)

No revisions yet.