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(**kwargs)

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(basename)

Returns path of a GDAL data file or None

Parameters:

basename (str) – Basename of a data file such as “gdalvrt.xsd”

Return type:

str (on success) or None (on failure)

search(prefix=None)

Returns GDAL data directory

Note well that os.environ is not consulted.

Return type:

str or None

search_debian(prefix='/home/docs/checkouts/readthedocs.org/user_builds/rasterio/conda/stable')

Check Debian locations

search_prefix(prefix='/home/docs/checkouts/readthedocs.org/user_builds/rasterio/conda/stable')

Check sys.prefix location

search_wheel(prefix=None)

Check wheel location

class rasterio._env.GDALEnv

Bases: 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

Return type:

bool

search(prefix=None)

Returns PROJ data directory

Note well that os.environ is not consulted.

Return type:

str or None

search_prefix(prefix='/home/docs/checkouts/readthedocs.org/user_builds/rasterio/conda/stable')

Check sys.prefix location

search_wheel(prefix=None)

Check wheel location

rasterio._env.catch_errors()

Intercept GDAL errors

rasterio._env.del_gdal_config(key)

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(key, normalize=True)

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.get_gdal_data()

Get the GDAL DATA path.

Return type:

str

rasterio._env.get_proj_data_search_paths()

Get the PROJ DATA search paths.

Return type:

List[str]

rasterio._env.set_gdal_config(key, val, normalize=True)

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(path)

Set PROJ data search path.