Skip to content

Commit aa6b4b6

Browse files
committed
Doc: add CLI examples for common non-trivial options
1 parent e878b5b commit aa6b4b6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

doc/source/programs/gdal_translate.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,15 @@ resampling, and rescaling pixels in the process.
128128

129129
``mode`` selects the value which appears most often of all the sampled points.
130130

131+
For example, to resample a raster using bilinear interpolation:
132+
133+
.. code-block:: console
134+
135+
gdal_translate -r bilinear input.tif resampled.tif
136+
137+
This is suitable for continuous data such as elevation or temperature when
138+
changing resolution.
139+
131140
.. option:: -scale [<src_min> <src_max> [<dst_min> <dst_max>]]
132141

133142
Rescale the input pixels values from the range **src_min** to **src_max**
@@ -206,6 +215,15 @@ resampling, and rescaling pixels in the process.
206215
by :option:`-a_nodata`. Alternatively, :program:`gdal_translate` can issue
207216
an error in this case if so directed by options :option:`-epo` or :option:`-eco`.
208217

218+
For example, to extract a spatial subset using projected coordinates:
219+
220+
.. code-block:: console
221+
222+
gdal_translate -projwin -20037500 10037500 0 0 input.tif subset.tif
223+
224+
This uses georeferenced coordinates (upper-left and lower-right corners),
225+
rather than pixel/line offsets.
226+
209227
.. note::
210228

211229
Beginning with GDAL 3.11, the extent described by :option:`-projwin` will

0 commit comments

Comments
 (0)