rasterio.rio.helpers module

Helper objects used by multiple CLI commands.

rasterio.rio.helpers.coords(obj)

Yield all coordinate coordinate tuples from a geometry or feature. From python-geojson package.

rasterio.rio.helpers.resolve_inout(input=None, output=None, files=None, overwrite=False, num_inputs=None)

Resolves inputs and outputs from standard args and options.

Parameters
  • input (str) – A single input filename, optional.

  • output (str) – A single output filename, optional.

  • files (str) – A sequence of filenames in which the last is the output filename.

  • overwrite (bool) – Whether to force overwriting the output file.

  • num_inputs (int) – Raise exceptions if the number of resolved input files is higher or lower than this number.

Returns

  • tuple (str, list of str) – The resolved output filename and input filenames as a tuple of length 2.

  • If provided, the output file may be overwritten. An output

  • file extracted from files will not be overwritten unless

  • overwrite is True.

Raises

click.BadParameter

rasterio.rio.helpers.to_lower(ctx, param, value)

Click callback, converts values to lowercase.

rasterio.rio.helpers.write_features(fobj, collection, sequence=False, geojson_type='feature', use_rs=False, **dump_kwds)

Read an iterator of (feat, bbox) pairs and write to file using the selected modes.