TransWikia.com

Get directory of raster from PostGIS?

Geographic Information Systems Asked on January 4, 2021

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:Tempraster_testDSM_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.

One Answer

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

returns

| st_bandpath                           |
| text                                  |
|---------------------------------------|
| C:Tempraster_testdsm_01_test.tif   |
| ....                                  |

Answered by Jonas on January 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP