ST_FromGDALRaster — 從支援的 GDAL 柵格檔案返回一個柵格。
raster ST_FromGDALRaster(
bytea gdaldata, integer srid=NULL)
;
從支援的 GDAL 柵格檔案返回一個柵格。gdaldata
的類型為 bytea,應該是 GDAL 柵格檔案的內容。
如果 srid
為 NULL,函數將嘗試從 GDAL 柵格自動分配 SRID。如果提供了 srid
,則提供的值將覆蓋任何自動分配的 SRID。
可用性:2.1.0
WITH foo AS ( SELECT ST_AsPNG(ST_AddBand(ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.1, -0.1, 0, 0, 4326), 1, '8BUI', 1, 0), 2, '8BUI', 2, 0), 3, '8BUI', 3, 0)) AS png ), bar AS ( SELECT 1 AS rid, ST_FromGDALRaster(png) AS rast FROM foo UNION ALL SELECT 2 AS rid, ST_FromGDALRaster(png, 3310) AS rast FROM foo ) SELECT rid, ST_Metadata(rast) AS metadata, ST_SummaryStats(rast, 1) AS stats1, ST_SummaryStats(rast, 2) AS stats2, ST_SummaryStats(rast, 3) AS stats3 FROM bar ORDER BY rid; rid | metadata | stats1 | stats2 | stats3 -----+---------------------------+---------------+---------------+---------------- 1 | (0,0,2,2,1,-1,0,0,0,3) | (4,4,1,0,1,1) | (4,8,2,0,2,2) | (4,12,3,0,3,3) 2 | (0,0,2,2,1,-1,0,0,3310,3) | (4,4,1,0,1,1) | (4,8,2,0,2,2) | (4,12,3,0,3,3) (2 rows)