rio shapes

Extracts shapes from one band or mask of a dataset and writes them out as GeoJSON. Unless otherwise specified, the shapes will be transformed to WGS 84 coordinates.

The default action of this command is to extract shapes from the first band of the input dataset. The shapes are polygons bounding contiguous regions (or features) of the same raster value. This command performs poorly for int16 or float type datasets.

Bands other than the first can be specified using the –bidx option:

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

The valid data footprint of a dataset’s i-th band can be extracted by using the –mask and –bidx options:

$ rio shapes –mask –bidx 1 tests/data/RGB.byte.tif

Omitting the –bidx option results in a footprint extracted from the conjunction of all band masks. This is generally smaller than any individual band’s footprint.

A dataset band may be analyzed as though it were a binary mask with the –as-mask option:

$ rio shapes –as-mask –bidx 1 tests/data/RGB.byte.tif

rio shapes [OPTIONS] INPUT

Options

-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 (‘,’, ‘:’).

--geographic

Output in geographic coordinates (the default).

--projected

Output in dataset’s own, projected coordinates.

--sequence, --collection

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

--rs, --no-rs

Use RS (0x1E) as a prefix for individual texts in a sequence as per http://tools.ietf.org/html/draft-ietf-json-text-sequence-13 (default is False).

--feature

Output as GeoJSON feature(s).

--bbox

Output as GeoJSON bounding box array(s).

--band, --mask

Choose to extract from a band (the default) or a mask.

--bidx <bandidx>

Index of the band or mask that is the source of shapes.

--sampling <sampling>

Inverse of the sampling fraction; a value of 10 decimates.

--with-nodata, --without-nodata

Include or do not include (the default) nodata regions.

--as-mask, --not-as-mask

Interpret a band as a mask and output only one class of valid data shapes.

Arguments

INPUT

Required argument