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

andy aborruso at gmail.com
Tue Dec 12 00:51:25 PST 2023


Hi all,
I had missed some messages, sorry.
But I still can't do a query on a raster.

I'll rewrite everything I've done.

I start with docker:

docker pull postgis/postgis:16-master

docker run --name postgis16 \
-p 5432:5432 \
-v /home/user/folder:/directory_docker \
-e POSTGRES_PASSWORD=thePassword \
-d postgis/postgis:16-master

Then I run

docker exec -it postgis16 bash

If I run "ls /directory_docker/" I get "ou_s6_01_01_stack.tif"

If I run "SELECT * FROM pg_ls_dir('/directory_docker');" I get
"ou_s6_01_01_stack.tif"

Then I load this tif in postgres

raster2pgsql -I -C -M -F -t auto -R /directory_docker/ou_s6_01_01_stack.tif
public.nome_tabella | psql -U postgres -d postgres

If I run

select * from nome_tabella limit 1;

I get something like

rid,rast,filename
1,01000....,ou_s6_01_01_stack.tif

Something that is strange for me is that there is no path, only the
filename.

At the end I run "SELECT ST_Value(rast, 1, 1) FROM nome_tabella;" and I get

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

Then I copy my tif in /var/lib/postgresql/data and I import it again using
raster2pgsql.

I have again

ERROR:  rt_band_load_offline_data: Cannot open offline raster:
/var/lib/postgresql/data/ou_s6_01_01_stack.tif


I'm sorry I'm boring you, it should be an immediate thing, I can't
understand what the problem might be.

Thank you (below my tif metadata),

Andrea



Tif Metadata, gdalinfo /directory_docker/ou_s6_01_01_stack.tif

Driver: GTiff/GeoTIFF
Files: /directory_docker/ou_s6_01_01_stack.tif
Size is 2500, 2280
Coordinate System is:
GEOGCRS["WGS 84",
    ENSEMBLE["World Geodetic System 1984 ensemble",
        MEMBER["World Geodetic System 1984 (Transit)"],
        MEMBER["World Geodetic System 1984 (G730)"],
        MEMBER["World Geodetic System 1984 (G873)"],
        MEMBER["World Geodetic System 1984 (G1150)"],
        MEMBER["World Geodetic System 1984 (G1674)"],
        MEMBER["World Geodetic System 1984 (G1762)"],
        MEMBER["World Geodetic System 1984 (G2139)"],
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]],
        ENSEMBLEACCURACY[2.0]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    USAGE[
        SCOPE["Horizontal component of 3D system."],
        AREA["World."],
        BBOX[-90,-180,90,180]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (6.502501000000001,47.702059000000006)
Pixel Size = (0.005002000000000,-0.005002000000000)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_SOFTWARE=ERDAS IMAGINE
Image Structure Metadata:
  COMPRESSION=PACKBITS
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (   6.5025010,  47.7020590) (  6d30' 9.00"E, 47d42' 7.41"N)
Lower Left  (   6.5025010,  36.2974990) (  6d30' 9.00"E, 36d17'51.00"N)
Upper Right (  19.0075010,  47.7020590) ( 19d 0'27.00"E, 47d42' 7.41"N)
Lower Right (  19.0075010,  36.2974990) ( 19d 0'27.00"E, 36d17'51.00"N)
Center      (  12.7550010,  41.9997790) ( 12d45'18.00"E, 41d59'59.20"N)
Band 1 Block=512x512 Type=Float32, ColorInterp=Red
Band 2 Block=512x512 Type=Float32, ColorInterp=Green
Band 3 Block=512x512 Type=Float32, ColorInterp=Blue
Band 4 Block=512x512 Type=Float32, ColorInterp=Undefined


-- 
___________________

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/20231212/e9beeb26/attachment.htm>


More information about the postgis-users mailing list