PostgreSQL/PostGIS – Error Accessing Offline Bands Disabled

postgispostgresql

I am using postgis functions i.e. ST_Clip, ST_PixelHeight.

But I am getting this error –

ERROR: rt_raster_load_offline_data: Access to offline bands disabled

Actually, I have loaded my raster to postgis using

raster2pgsql

In raster2pgsql I have used -R option for saving only the metadata of the raster and path location to the raster in the database (not the pixels).

How to solve this issue ?

Best Answer

Have you set the environment variables to enable rasters ?

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.

If you want to enable offline raster:

POSTGIS_ENABLE_OUTDB_RASTERS=1
Any other setting or no setting at all will disable out of db rasters.

In order to enable all GDAL drivers available in your GDAL install, set this environment variable as follows

POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL

From http://postgis.net/docs/postgis_installation.html#install_short_version