Opened 6 years ago

Closed 6 years ago

#4130 closed defect (invalid)

PostGIS and GDAL: ST_AsGDALRaster doesn't work

Reported by: lerocchi Owned by: pramsey
Priority: critical Milestone: PostGIS 2.4.5
Component: postgis Version: 2.4.x
Keywords: Cc:

Description

ST_AsGDALRaster doesn't work when using specific GDAL Format (e.g. WMS or RST). When I run this query:

select ST_AsGDALRaster(rast,'WMS') from my_raster

I will get the error: ERROR: rt_raster_to_gdal: Could not create the output GDAL dataset

The error occurs on Ubuntu 16.04 with Postgresql 10 and Postgis 2.4. In order to enable all GDAL drivers I run

ALTER DATABASE gisdb SET postgis.gdal_datapath = '/usr/share/gdal/2.2'; ALTER DATABASE gisdb SET postgis.gdal_enabled_drivers TO 'ENABLE_ALL'; ALTER DATABASE gisdb SET postgis.postgis.enable_outdb_rasters TO true;

Change History (4)

comment:1 by Bborie Park, 6 years ago

Resolution: invalid
Status: newclosed

GDAL can't create WMS rasters. Please refer to GDAL's docs:

http://www.gdal.org/formats_list.html

comment:2 by lerocchi, 6 years ago

Resolution: invalid
Status: closedreopened

I see, but I have the same issue with other format that GDAL can create (e.g. RST). ST_AsGDALRaster works only with PNG and GeoTIFF.

comment:3 by Bborie Park, 6 years ago

We should really move this to the postgis-users ML given we don't know what the issue here is. But since we're here...

Try setting those env parameters in postgresql's environment file found at (/etc/postgresql/10/<MY_PG_CLUSTER_NAME>/environment). In my environment file...

POSTGIS_GDAL_ENABLED_DRIVERS = 'ENABLE_ALL'

POSTGIS_ENABLE_OUTDB_RASTERS = 1

GDAL_DISABLE_READDIR_ON_OPEN = 'TRUE'

And then have your postgresql reloaded/restarted

Last edited 6 years ago by Bborie Park (previous) (diff)

comment:4 by pramsey, 6 years ago

Resolution: invalid
Status: reopenedclosed
Note: See TracTickets for help on using tickets.