rio warp

Warp a raster dataset.

If a template raster is provided using the –like option, the coordinate reference system, affine transform, and dimensions of that raster will be used for the output. In this case –dst-crs, –bounds, –res, and –dimensions options are not applicable and an exception will be raised.

$ rio warp input.tif output.tif –like template.tif

The output coordinate reference system may be either a PROJ.4 or EPSG:nnnn string,

–dst-crs EPSG:4326
–dst-crs ‘+proj=longlat +ellps=WGS84 +datum=WGS84’

or a JSON text-encoded PROJ.4 object.

–dst-crs ‘{“proj”: “utm”, “zone”: 18, …}’

If –dimensions are provided, –res and –bounds are not applicable and an exception will be raised. Resolution is calculated based on the relationship between the raster bounds in the target coordinate system and the dimensions, and may produce rectangular rather than square pixels.

$ rio warp input.tif output.tif –dimensions 100 200
> –dst-crs EPSG:4326

If –bounds are provided, –res is required if –dst-crs is provided (defaults to source raster resolution otherwise).

$ rio warp input.tif output.tif
> –bounds -78 22 -76 24 –res 0.1 –dst-crs EPSG:4326
rio warp [OPTIONS] INPUTS... OUTPUT

Options

-o, --output <output>

Path to output file (optional alternative to a positional arg).

-f, --format, --driver <driver>

Output format driver

--like <like>

Raster dataset to use as a template for obtaining affine transform (bounds and resolution), and crs.

--dst-crs <dst_crs>

Target coordinate reference system.

--dimensions <dimensions>

Output dataset width, height in number of pixels.

--src-bounds <src_bounds>

Determine output extent from source bounds: left bottom right top . Cannot be used with destination –bounds

--bounds, --dst-bounds <dst_bounds>

Determine output extent from destination bounds: left bottom right top

-r, --res <res>

Output dataset resolution in units of coordinate reference system. Pixels assumed to be square if this option is used once, otherwise use: –res pixel_width –res pixel_height.

--resampling <resampling>

Resampling method.

Default

nearest

Options

nearest | bilinear | cubic | cubic_spline | lanczos | average | mode | max | min | med | q1 | q3 | sum | rms

--src-nodata <src_nodata>

Manually override source nodata

--dst-nodata <dst_nodata>

Manually override destination nodata

--threads <threads>

Number of processing threads.

--check-invert-proj, --no-check-invert-proj

Constrain output to valid coordinate region in dst-crs

--target-aligned-pixels, --no-target-aligned-pixels

align the output bounds based on the resolution

--overwrite

Always overwrite an existing output file.

--co, --profile <NAME=VALUE>

Driver specific creation options. See the documentation for the selected output driver for more information.

--to, --wo, --transformer-option, --warper-option <NAME=VALUE>

GDAL warper and coordinate transformer options.

Arguments

INPUTS... OUTPUT

Required argument(s)