rasterio._env module

GDAL and OGR driver and configuration management

The main thread always utilizes CPLSetConfigOption. Child threads utilize CPLSetThreadLocalConfigOption instead. All threads use CPLGetConfigOption and not CPLGetThreadLocalConfigOption, thus child threads will inherit config options from the main thread unless the option is set to a new value inside the thread.

class rasterio._env.ConfigEnv

Bases: object

Configuration option management

clear_config_options()

Clear GDAL config options.

get_config_options()
options
update_config_options()

Update GDAL config options.

class rasterio._env.GDALDataFinder

Bases: object

Finds GDAL data files

Note: this is not part of the public API in 1.0.x.

find_file

Returns path of a GDAL data file or None

Parameters

basename (str) – Basename of a data file such as “header.dxf”

Returns

Return type

str (on success) or None (on failure)

search

Returns GDAL data directory

Note well that os.environ is not consulted.

Returns

Return type

str or None

search_debian

Check Debian locations

search_prefix

Check sys.prefix location

search_wheel

Check wheel location

class rasterio._env.GDALEnv

Bases: rasterio._env.ConfigEnv

Configuration and driver management

drivers()
start()
stop()
class rasterio._env.PROJDataFinder

Bases: object

Finds PROJ data files

Note: this is not part of the public API in 1.0.x.

has_data

Returns True if PROJ’s data files can be found

Returns

Return type

bool

search

Returns PROJ data directory

Note well that os.environ is not consulted.

Returns

Return type

str or None

search_prefix

Check sys.prefix location

search_wheel

Check wheel location

rasterio._env.catch_errors()

Intercept GDAL errors

rasterio._env.del_gdal_config()

Delete a GDAL configuration option.

Parameters

key (str) – Name of config option.

rasterio._env.driver_count()

Return the count of all drivers

rasterio._env.get_gdal_config()

Get the value of a GDAL configuration option. When requesting GDAL_CACHEMAX the value is returned unaltered.

Parameters
  • key (str) – Name of config option.

  • normalize (bool, optional) – Convert values of "ON"' and "OFF" to True and False.

rasterio._env.set_gdal_config()

Set a GDAL configuration option’s value.

Parameters
  • key (str) – Name of config option.

  • normalize (bool, optional) – Convert True to “ON” and False to “OFF”`.

rasterio._env.set_proj_data_search_path()

Set PROJ data search path