I have a postgresql remote database where all postgis and raster features have been enabled.
I am trying to execute a query of a raster table within a schema but the system returns the following error
rt_raster_to_gdal: Could not load the output GDAL driver
by using the following code
import psycopg2
from rasterio.io import MemoryFile
import rioxarray as riox
# DB Configuration
dbname = "Database"
dbuser = "user"
dbpass = "pass"
dbhost = "host.com"
dbport = "8080"
try:
conn = psycopg2.connect(database=dbname, user=dbuser, password=dbpass, host=dbhost, port=dbport)
curs = conn.cursor()
print("Database connected successfully")
except:
print("Database not connected successfully")
curs.execute("select ST_AsGDALRaster(st_union(rast), 'GTIFF') from schema.table;")
result = curs.fetchone()
I have tried also to add the follow code to previouse script but nothing change
curs.execute("SET postgis.gdal_enabled_drivers = 'ENABLE_ALL';")
how can i fix this issue?