[postgis-users] out db: not able to query the raster

Regina Obe lr at pcorp.us
Mon Dec 4 16:19:25 PST 2023


Are you running postgres inside the docker container or are you using your own?

 

I wasn’t clear if you are just using the raster2pgsql from docker or you are using the postgresql as well.

 

It’s possible inside the container it doesn’t know the path as such.

 

Try this query in your postgresql, to see if your postgresql can read that path

 

SELECT *

FROM pg_ls_dir('/directory_docker');

 

And can read the file

 

SELECT *

FROM pg_stat_file('/directory_docker/ou_s6_01_01_stack.tif ');

 

 

From: postgis-users <postgis-users-bounces at lists.osgeo.org> On Behalf Of andy via postgis-users
Sent: Monday, December 4, 2023 5:24 PM
To: PostGIS Users Discussion <postgis-users at lists.osgeo.org>
Cc: andy <aborruso at gmail.com>
Subject: [postgis-users] out db: not able to query the raster

 

Hi,

if I run "SELECT (ST_BandMetaData(rast)).* FROM rasters_outdb LIMIT 1;", in the field path I have "/directory_docker/ou_s6_01_01_stack.tif"

 

If I run "ls -l /directory_docker/ou_s6_01_01_stack.tif" I have

-rwxr--r-- 1 1000 1000 2100227 Dec  4 08:32 /directory_docker/ou_s6_01_01_stack.tif

 

But when I run "SELECT ST_Value(rast, 1, 1) FROM rasters_outdb;" I get 

ERROR:  rt_band_load_offline_data: Cannot open offline raster: /directory_docker/ou_s6_01_01_stack.tif

 

Why is it offline? It's there.

I'm using postgis/postgis:16-master

 

I have created the sql file to load it in postgres, running

 

raster2pgsql -I -C -M -F -t auto -R /directory_docker/ou_s6_01_01_stack.tif public.rasters_outdb

 

How to read the pixel values using a PG SQL query?

 

Thank you


 

-- 

___________________

 

Andrea Borruso
website: https://medium.com/tantotanto
38° 7' 48" N, 13° 21' 9" E, EPSG:4326
___________________

"cercare e saper riconoscere chi e cosa,
 in mezzo all’inferno, non è inferno, 
e farlo durare, e dargli spazio"

Italo Calvino

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20231204/c9e7ab2b/attachment.htm>


More information about the postgis-users mailing list