This section lists custom PostGIS Grand Unified Custom Variables (GUC). These can be set globally, by database, by session or by transaction. Best set at global or database level.

# Grand Unified Custom Variables (GUCs)

postgis.backend

The backend to service a function where GEOS and SFCGAL overlap. Options: geos or sfcgal. Defaults to geos.

### Description

This GUC is only relevant if you compiled PostGIS with sfcgal support. By default `geos` backend is used for functions where both GEOS and SFCGAL have the same named function. This variable allows you to override and make sfcgal the backend to service the request.

Availability: 2.1.0

### Examples

Sets backend just for life of connection

    set postgis.backend = sfcgal;

Sets backend for new connections to database

    ALTER DATABASE mygisdb SET postgis.backend = sfcgal;

### See Also

reference_sfcgal

postgis.gdal_datapath

A configuration option to assign the value of GDAL's GDAL_DATA option. If not set, the environmentally set GDAL_DATA variable is used.

### Description

A PostgreSQL GUC variable for setting the value of GDAL's GDAL_DATA option. The `postgis.gdal_datapath` value should be the complete physical path to GDAL's data files.

This configuration option is of most use for Windows platforms where GDAL's data files path is not hard-coded. This option should also be set when GDAL's data files are not located in GDAL's expected path.

This option can be set in PostgreSQL's configuration file postgresql.conf. It can also be set by connection or transaction.

Availability: 2.2.0

Additional information about GDAL_DATA is available at GDAL's Configuration Options.

### Examples

Set and reset `postgis.gdal_datapath`

    SET postgis.gdal_datapath TO '/usr/local/share/gdal.hidden';
    SET postgis.gdal_datapath TO default;

Setting on windows for a particular database

    ALTER DATABASE gisdb
    SET postgis.gdal_datapath = 'C:/Program Files/PostgreSQL/9.3/gdal-data';

### See Also

RT_PostGIS_GDAL_Version, RT_ST_Transform

postgis.gdal_enabled_drivers

A configuration option to set the enabled GDAL drivers in the PostGIS environment. Affects the GDAL configuration variable GDAL_SKIP.

### Description

A configuration option to set the enabled GDAL drivers in the PostGIS environment. Affects the GDAL configuration variable GDAL_SKIP. This option can be set in PostgreSQL's configuration file: postgresql.conf. It can also be set by connection or transaction.

The initial value of `postgis.gdal_enabled_drivers` may also be set by passing the environment variable `POSTGIS_GDAL_ENABLED_DRIVERS` with the list of enabled drivers to the process starting PostgreSQL.

Enabled GDAL specified drivers can be specified by the driver's short-name or code. Driver short-names or codes can be found at GDAL Raster Formats. Multiple drivers can be specified by putting a space between each driver.

There are three special codes available for `postgis.gdal_enabled_drivers`. The codes are case-sensitive.

- `DISABLE_ALL` disables all GDAL drivers. If present, `DISABLE_ALL` overrides all other values in `postgis.gdal_enabled_drivers`.

- `ENABLE_ALL` enables all GDAL drivers.

- `VSICURL` enables GDAL's `/vsicurl/` virtual file system.

When `postgis.gdal_enabled_drivers` is set to DISABLE_ALL, attempts to use out-db rasters, ST_FromGDALRaster(), ST_AsGDALRaster(), ST_AsTIFF(), ST_AsJPEG() and ST_AsPNG() will result in error messages.

In the standard PostGIS installation, `postgis.gdal_enabled_drivers` is set to DISABLE_ALL.

Additional information about GDAL_SKIP is available at GDAL's Configuration Options.

Availability: 2.2.0

### Examples

Set and reset `postgis.gdal_enabled_drivers`

Sets backend for all new connections to database

    ALTER DATABASE mygisdb SET postgis.gdal_enabled_drivers TO 'GTiff PNG JPEG';

Sets default enabled drivers for all new connections to server. Requires super user access and PostgreSQL 9.4+. Also note that database, session, and user settings override this.

    ALTER SYSTEM SET postgis.gdal_enabled_drivers TO 'GTiff PNG JPEG';
    SELECT pg_reload_conf();

    SET postgis.gdal_enabled_drivers TO 'GTiff PNG JPEG';
    SET postgis.gdal_enabled_drivers = default;

Enable all GDAL Drivers

    SET postgis.gdal_enabled_drivers = 'ENABLE_ALL';

Disable all GDAL Drivers

    SET postgis.gdal_enabled_drivers = 'DISABLE_ALL';

### See Also

RT_ST_FromGDALRaster, RT_ST_AsGDALRaster, RT_ST_AsTIFF, RT_ST_AsPNG, RT_ST_AsJPEG, postgis_enable_outdb_rasters

postgis.enable_outdb_rasters

A boolean configuration option to enable access to out-db raster bands.

### Description

A boolean configuration option to enable access to out-db raster bands. This option can be set in PostgreSQL's configuration file: postgresql.conf. It can also be set by connection or transaction.

The initial value of `postgis.enable_outdb_rasters` may also be set by passing the environment variable `POSTGIS_ENABLE_OUTDB_RASTERS` with a non-zero value to the process starting PostgreSQL.

Even if `postgis.enable_outdb_rasters` is True, the GUC `postgis.gdal_enabled_drivers` determines the accessible raster formats.

In the standard PostGIS installation, `postgis.enable_outdb_rasters` is set to False.

Availability: 2.2.0

### Examples

Set and reset `postgis.enable_outdb_rasters` for current session

    SET postgis.enable_outdb_rasters TO True;
    SET postgis.enable_outdb_rasters = default;
    SET postgis.enable_outdb_rasters = True;
    SET postgis.enable_outdb_rasters = False;

Set for specific database

    ALTER DATABASE gisdb SET postgis.enable_outdb_rasters = true;

Setting for whole database cluster. You need to reconnect to the database for changes to take effect.

     --writes to postgres.auto.conf
    ALTER SYSTEM postgis.enable_outdb_rasters = true;
     --Reloads postgres conf
    SELECT pg_reload_conf();

### See Also

postgis_gdal_enabled_drivers postgis_gdal_vsi_options

postgis.gdal_config_options

A string configuration to set options used when working with an out-db raster.

### Description

A string configuration to set options used when working with an out-db raster. Configuration options control things like how much space GDAL allocates to local data cache, whether to read overviews, and what access keys to use for remote out-db data sources.

Availability: 3.2.0

### Examples

Set `postgis.gdal_vsi_options` for current session:

    SET postgis.gdal_config_options = 'AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxx AWS_SECRET_ACCESS_KEY=yyyyyyyyyyyyyyyyyyyyyyyyyy';

Set `postgis.gdal_vsi_options` just for the current transaction using the `LOCAL` keyword:

    SET LOCAL postgis.gdal_config_options = 'AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxx AWS_SECRET_ACCESS_KEY=yyyyyyyyyyyyyyyyyyyyyyyyyy';

### See Also

postgis_enable_outdb_rasters postgis_gdal_enabled_drivers