I am currently testing the functionality of raster in Postgis. I have found the option of creating "register" (or out-db) tables in PostGIS, which link to the rasterfile outside the database, using the ´-R´ flag:

raster2pgsql -R C:\Temp\raster_test\DSM_01_test.tif test.dsm_01_test| psql..... 

As far as I understand it the PostgreSQL/PostGIS table does not store the raster file itself - only metadata is stored. As the documentation states it:

Only the metadata of the raster and path location to the raster is stored in the database (not the pixels)

with my out-db raster tabletest.dsm_01_test, how do I get the path of the rasterfile from the PostGIS database?

I have tried the table raster_columns, but it doesn't hold the path to the rasterfile.

1 Answer 1


Having re-read Chapter 9, I found st_bandpath to do exactly what I was looking for:

SELECT st_bandpath(rast) 
FROM test.dsm_01_test


| st_bandpath                           |
| text                                  |
| C:\Temp\raster_test\dsm_01_test.tif   |
| ....                                  |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.