[postgis-users] Determine Out of DB Raster full path to file name

Regina Obe lr at pcorp.us
Wed Mar 4 17:40:11 PST 2020

You are probably looking at the raw table with filename that gets put in by -F

To get the full path, use ST_BandPath


I'll put an example in the docs for it -- sorry for the missing example.

Your query should look something like

SELECT rid, filename, ST_BandPath(rast,1) AS full_path
FROM ahn3.ahn3_69cn2_out

Note that ST_BandPath is a band meta data function, thus the extra band arg, not raster meta data.

The reason for that is postgis raster supports cases where each band of a specific raster  comes from a different file (though you can't really achieve such a crazy goal by using raster2pgsql I don't think), but you can with SQL.

Hope that helps,

> -----Original Message-----
> From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On
> Behalf Of Richard Huesken
> Sent: Wednesday, March 4, 2020 3:21 PM
> To: postgis-users at lists.osgeo.org
> Subject: [postgis-users] Determine Out of DB Raster full path to file name
> Hi,
> When loading an out of DB Raster into postgis (3.01, postgres 12.2) using
> raster2pgsql, I need to specify the exact filename.
> raster2pgsql -s 28992 -t 100x100 -F -I -C -Y -R
> C:\TestData\AHN3\M_69CN2\M_69CN2.TIF ahn3.ahn3_69cn2_out
> In the metadata (postgres raster table (ahn3.ahn3_69cn2_out) only the
> filename is listed (M_69CN2.TIF), without the full path.
> Is there a way to trace back the full pathname for this raster?
> Kind regards,
> Richard.
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users

More information about the postgis-users mailing list