rio rasterize

Rasterize GeoJSON into a new or existing raster.

If the output raster exists, rio-rasterize will rasterize feature values into all bands of that raster. The GeoJSON is assumed to be in the same coordinate reference system as the output unless –src-crs is provided.

–default_value or property values when using –property must be using a data type valid for the data type of that raster.

If a template raster is provided using the –like option, the affine transform and data type from that raster will be used to create the output. Only a single band will be output.

The GeoJSON is assumed to be in the same coordinate reference system unless –src-crs is provided.

–default_value or property values when using –property must be using a data type valid for the data type of that raster.

–driver, –bounds, –dimensions, –res, –nodata are ignored when output exists or –like raster is provided

If the output does not exist and –like raster is not provided, the input GeoJSON will be used to determine the bounds of the output unless provided using –bounds.

–dimensions or –res are required in this case.

If –res is provided, the bottom and right coordinates of bounds are ignored.

Note

The GeoJSON is not projected to match the coordinate reference system of the output or –like rasters at this time. This functionality may be added in the future.

rio rasterize [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), crs, data type, and driver used to create the output.

--bounds <bounds>

Bounds: ‘left bottom right top’ or ‘[left, bottom, right, top]’.

--dimensions <dimensions>

Output dataset width, height in number of pixels.

-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.

--src-crs, --src_crs <src_crs>

Source coordinate reference system. Limited to EPSG codes for now. Used as output coordinate system if output does not exist or –like option is not used. Default: EPSG:4326

-a, --all, --all_touched

Use all pixels touched by features, otherwise (default) use only pixels whose center is within the polygon or that are selected by Bresenhams line algorithm

--default-value, --default_value <default_value>

Default value for rasterized pixels

--fill <fill>

Fill value for all pixels not overlapping features. Will be evaluated as NoData pixels for output. Default: 0

--property <prop>

Property in GeoJSON features to use for rasterized values. Any features that lack this property will be given –default_value instead.

--overwrite

Always overwrite an existing output file.

--nodata <NUMBER|nan>

Set a Nodata value.

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

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

Arguments

INPUTS... OUTPUT

Optional argument(s)