rio blocks

Write dataset blocks as GeoJSON features.

This command writes features describing a raster’s internal blocks, which are used directly for raster I/O. These features can be used to visualize how a windowed operation would operate using those blocks.

Output features have two JSON encoded properties: block and window. Block is a two element array like ‘[0, 0]’ describing the window’s position in the input band’s window layout. Window is a two element array containing two more two element arrays like ‘[[0, 256], [0, 256]’ and describes the range of pixels the window covers in the input band. Values are JSON encoded for better interoperability.

Block windows are extracted from the dataset (all bands must have matching block windows) by default, or from the band specified using the ‘–bidx option:

$ rio blocks –bidx 3 tests/data/RGB.byte.tif

By default a GeoJSON ‘FeatureCollection’ is written, but the –sequence’ option produces a GeoJSON feature stream instead.

$ rio blocks tests/data/RGB.byte.tif –sequence

Output features are reprojected to ‘WGS84’ unless the ‘–projected’ flag is provided, which causes the output to be kept in the input datasource’s coordinate reference system.

For more information on exactly what blocks and windows represent, see ‘dataset.block_windows()’.

rio blocks [OPTIONS] INPUT


-o, --output <output>

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

--precision <precision>

Decimal precision of coordinates.

--indent <indent>

Indentation level for JSON output

--compact, --not-compact

Use compact separators (‘,’, ‘:’).


Output in dataset’s own, projected coordinates.

--sequence, --no-sequence

Write a LF-delimited sequence of texts containing individual objects or write a single JSON text containing a feature collection object (the default).

--rs, --no-rs

Use RS (0x1E) as a prefix for individual texts in a sequence as per (default is False).

--bidx <bidx>

Index of the band that is the source of shapes.



Required argument