I have already set the environment in windows

SET postgis.gdal_enabled_drivers = 'ENABLE_ALL';

Even I tried by adding following in environment path-


But still I am getting error:

ERROR: rt_raster_to_gdal: Could not load the output GDAL driver SQL

The query I am running is

SELECT ST_AsGDALRaster(rast, 'GTiff') As rastjpg
FROM myRaster WHERE rid=1;

How to remove this issue?

  • GDAL library is been installed properly? Can you run gdalinfo command without problem? May 6, 2015 at 10:54
  • Try this command: SET postgis.gdal_enabled_drivers = 'ENABLE_ALL'; Jan 2, 2017 at 16:02
  • @JulianLinares The OP stated at the very beginning of the question that they already ran that command. Jan 2, 2017 at 18:50
  • In psql, run SET postgis.gdal_enabled_drivers = 'ENABLE_ALL'; then paste the output of SELECT short_name FROM st_gdal_drivers(); Jan 2, 2017 at 19:37
  • what version of PostGIS? May 24, 2017 at 19:04

1 Answer 1


It seems likely that you're not using PostGIS 2.2.

Pay special attention to postgis.enable_outdb_rasters.

Taken from my answer on GIS.SE

As explained in the PostGIS blog,

This has been an issue since our release of 2.0.6/2.13 PostGIS security patches that by default disabled all raster drivers and out-of-db raster storage. Raster is much less useful if you don’t have any raster drivers enabled, so you need to renable them or the selective ones you need.

The interface you're using is referred to as Grand Unified Custom Variables (GUC). It's a PostGIS 2.2 thing.

If using PostGIS 2.1, you do not GUC, you must set them on the command line,

As of PostGIS 2.1.3, out-of-db rasters and all raster drivers are disabled by default. In order to re-enable these, you need to set the following environment variables POSTGIS_GDAL_ENABLED_DRIVERS and POSTGIS_ENABLE_OUTDB_RASTERS in the server environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.