[postgis-users] ERROR: rt_raster_to_gdal: Could not create the output GDAL dataset

john polo jpolo at mail.usf.edu
Wed Feb 12 09:51:27 PST 2020


Hi,

I am using PostgreSQL 12 and PostGIS 3 on Windows 10. I am using a 
practice example for working with raster via psql. The values, like 
"131072" are from the book, so I don't know exactly what they mean (or 
much about the lo_ functions for that matter, other than they are meant 
for large object processing):

SELECT oid, lowrite(lo_open(oid, 131072), img) As num_bytes
FROM (
     VALUES (
         lo_create(0),
         (SELECT
             ST_AsGDALRaster(ST_Band(rast,1),
             'USGSDEM',
             ARRAY[
                 'PRODUCER=' || quote_literal('postgis_in_action'),
                 'INTERNALNAME=' || quote_literal(rast_name)]
             ) As dem
         FROM ch07.bag_o_rasters
         WHERE rast_name = 'Raster 1 band heatmap')
     )
) As v(oid,img);

I get the error:

"ERROR:  rt_raster_to_gdal: Could not create the output GDAL dataset"

I am connected to PostgreSQL:

postgis_in_action=# \conninfo

You are connected to database "postgis_in_action" as user "postgres" on 
host "localhost" (address "::1") at port "5432".

and a simple SELECT for the row ID of the 'Raster 1 band heatmap' works. 
I tried the same code in pgAdmin and got the same results. I searched 
for solutions. I found something that said to check the GDAL settings:

postgis_in_action=# SELECT short_name FROM ST_GDALDrivers();
short_name
GTiff
AAIGrid
DTED
PNG
JPEG
GIF
USGSDEM
XYZ
(8 rows)

It seems that GDAL is set to produce a USGSDEM.

I don't know why I am getting the error. Can someone suggest how I fix 
this, please?

best regards,
John Polo


-- 
Enlightenment is ego's ultimate disappointment.
-Chogyam Trungpa

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200212/caa26d26/attachment.html>


More information about the postgis-users mailing list