<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi,</p>
<p>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):</p>
<tt>SELECT oid, lowrite(lo_open(oid, 131072), img) As num_bytes</tt><tt><br>
</tt><tt>FROM (</tt><tt><br>
</tt><tt> VALUES (</tt><tt><br>
</tt><tt> lo_create(0),</tt><tt><br>
</tt><tt> (SELECT </tt><tt><br>
</tt><tt> ST_AsGDALRaster(ST_Band(rast,1), </tt><tt><br>
</tt><tt> 'USGSDEM',</tt><tt><br>
</tt><tt> ARRAY[</tt><tt><br>
</tt><tt> 'PRODUCER=' ||
quote_literal('postgis_in_action'),</tt><tt><br>
</tt><tt> 'INTERNALNAME=' ||
quote_literal(rast_name)]</tt><tt><br>
</tt><tt> ) As dem</tt><tt><br>
</tt><tt> FROM ch07.bag_o_rasters </tt><tt><br>
</tt><tt> WHERE rast_name = 'Raster 1 band heatmap')</tt><tt><br>
</tt><tt> )</tt><tt><br>
</tt><tt>) As v(oid,img);</tt>
<p>I get the error:</p>
<pre>"ERROR: rt_raster_to_gdal: Could not create the output GDAL dataset "</pre>
<p>I am connected to PostgreSQL:</p>
<p><tt>postgis_in_action=# \conninfo </tt><tt><br>
</tt></p>
<p><tt>You are connected to database "postgis_in_action" as user
"postgres" on host "localhost" (address "::1") at port "5432".</tt><tt><br>
</tt></p>
<p>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:</p>
<pre>postgis_in_action=# SELECT short_name FROM ST_GDALDrivers();
short_name
GTiff
AAIGrid
DTED
PNG
JPEG
GIF
USGSDEM
XYZ
(8 rows)
</pre>
<p>It seems that GDAL is set to produce a USGSDEM. <br>
</p>
<p>I don't know why I am getting the error. Can someone suggest how
I fix this, please?</p>
best regards,<br>
John Polo<br>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
Enlightenment is ego's ultimate disappointment.
-Chogyam Trungpa</pre>
</body>
</html>