1

PostGIS can use out-db rasters, stored as Cloud Optimised GeoTIFF (COG) in external storage, like S3 or GCS. PostGIS will use HTTP Range Requests to fetch parts of the TIFF.

How does PostGIS know which byte range to request? I don't see such information here:

select b.rid, (b.meta).*, (b.bandmeta).* from (select rid, st_metadata(rast) as meta, st_bandmetadata(rast, 1) as bandmeta from my_tiled_remote_raster) as b;

| rid | upperleftx | upperlefty | width | height | scalex | scaley | skewx | skewy | srid | numbands | pixeltype | nodatavalue | isoutdb | path | outdbbandnum | filesize | filetimestamp |
| 1 | -14930329.0619462 | 6912576.8945718445 | 256 | 256 | 3738.064687613865 | -3738.064687613865 | 0 | 0 | 3857 | 1 | 64BF | NULL | true | /vsigs/my-bucket/my-file.grib2.tiff | 1 | 23594839 | 1659367574 |
(...other tiles for the same TIFF...)

1 Answer 1

2

PostGIS knows only the location of the out-db raster. GDAL drivers https://postgis.net/docs/postgis_gdal_enabled_drivers.html are doing the hard work. When the type of the out-db raster is COG the driver that gets used is https://gdal.org/drivers/raster/cog.html and it knows how to read the required metadata from the TIFF headers and Image Filed Directories and finally create the HTTP Range Requests for accessing the raster data.

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.