rio blocks

Write dataset blocks as GeoJSON features.

This command prints 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 JSON serialization of rasterio’s Window class like {“col_off”: 0, “height”: 3, “row_off”: 705, “width”: 791}.

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 OGC:CRS84 (WGS 84) 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 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