Skip to main content

clear_gdal_conf_from_env

Remove the environment variables set by export_gdal_conf_to_env.

Raises

  • KeyError: If the variables are not set.

export_gdal_conf_to_env

Export the GDAL configuration to environment variables for subprocesses. Sedona reads the S3 configuration of out-db rasters from the Spark session, which a subprocess cannot see. Call this before starting subprocesses that read out-db rasters, so that they load the configuration from the environment instead. Variables that are already set are left unchanged.

get_gdal_conf

GDAL configuration options for reading path.

Parameters

str
required
Path of the file to read. A path starting with s3://, s3a:// or /vsis3/ gets the options of its bucket; see get_gdal_conf_for_s3_bucket.

Returns

dict of str to str
GDAL configuration options, or an empty dict for other paths.

get_gdal_conf_for_s3_bucket

GDAL configuration options for reading from an S3 bucket. The options come from the Spark session’s spark.hadoop.fs.s3a.* configuration, using the bucket’s own spark.hadoop.fs.s3a.bucket.<bucket>.* settings when it has them, or from the environment variables set by export_gdal_conf_to_env. Assumed-role credentials are resolved into AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN.

Parameters

str
required
Name of the S3 bucket.

Returns

dict of str to str
GDAL configuration options, or an empty dict if there is no configuration.

get_rasterio_aws_session

A rasterio AWS session with the credentials Sedona uses to read path. Pass it to rasterio.Env(session=...) to open files on S3 with rasterio using the same configuration as Sedona’s out-db rasters.

Parameters

str
required
Path of the file to read.

Returns

rasterio.session.AWSSession or None
The session, or None if there is no configuration for path or boto3 is not installed.