On 11/1/24 09:49, thiemo@gelassene-pferde.biz wrote:
>
> Adrian Klaver <adrian.klaver@aklaver.com> escribió:
>
>>> psycopg2.errors.InternalError_: RASTER_fromGDALRaster: Could not open
>>> bytea with GDAL. Check that the bytea is of a GDAL supported format
>>
>> This looks to be on the PostGIS end related to the ST_FromGDALRaster()
>> function. Does:
>>
>> select ST_FromGDALRaster(the_field);
>>
>> work in psql?
>
> Thanks for looking into it. I am not sure, however, what you refer to
> with the_field. Be it as it may, the following might answer your question.
It was just a placeholder name to represent whatever field the function
was working on.
The error messages spell out the problem. or at least an initial one,
the GDAL drivers are not being loaded. Looks like the connection user
does not have sufficient privileges to load them.
>
> thiemo @ hotrod ~ % psql -p 5447 -d treintaytres -U treintaytres
> psql (17.0 (Debian 17.0-1.pgdg120+1))
> Type "help" for help.
>
> treintaytres=> set postgis.gdal_enabled_drivers = 'ENABLE_ALL';
> SET
> treintaytres=> WITH foo AS (
> SELECT
> ST_AsPNG(ST_AddBand(ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0,
> 0.1, -0.1, 0, 0, 4326), 1, '8BUI', 1, 0), 2, '8BUI', 2, 0), 3, '8BUI',
> 3, 0)) AS png
> ),
> bar AS (
> SELECT 1 AS rid, ST_FromGDALRaster(png) AS rast FROM foo
> UNION ALL
> SELECT 2 AS rid, ST_FromGDALRaster(png, 3310) AS rast FROM foo
> )
> SELECT
> rid,
> ST_Metadata(rast) AS metadata,
> ST_SummaryStats(rast, 1) AS stats1,
> ST_SummaryStats(rast, 2) AS stats2,
> ST_SummaryStats(rast, 3) AS stats3
> FROM bar
> ORDER BY rid;
> WARNING: permission denied to set parameter "postgis.gdal_enabled_drivers"
> ERROR: rt_raster_to_gdal: Could not load the output GDAL driver
> CONTEXT: PL/pgSQL function st_aspng(raster,text[]) line 31 at RETURN
>
>
>
> Many thanks for your support.
>
>
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com