ST_BandMetaData — 返回特定栅格波段的基本元数据。如果未指定,则假设波段号为 1。
(1) record ST_BandMetaData(
raster rast, integer band=1)
;
(2) record ST_BandMetaData(
raster rast, integer[] band)
;
返回有关栅格波段的基本元数据。返回的列:pixeltype、nodatavalue、isoutdb、path、outdbbandnum、filesize、filetimestamp。
如果栅格不包含任何波段,则会引发错误。 |
如果波段没有 NODATA 值,则 nodatavalue 为 NULL。 |
如果 isoutdb 为 False,则 path、outdbbandnum、filesize 和 filetimestamp 为 NULL。如果禁用了 outdb 访问,则 filesize 和 filetimestamp 也将为 NULL。 |
增强:2.5.0 包含了 outdb 栅格的 outdbbandnum、filesize 和 filetimestamp。
SELECT rid, (foo.md).* FROM ( SELECT rid, ST_BandMetaData(rast, 1) AS md FROM dummy_rast WHERE rid=2 ) As foo; rid | pixeltype | nodatavalue | isoutdb | path | outdbbandnum -----+-----------+---- --------+---------+------+-------------- 2 | 8BUI | 0 | f | |
WITH foo AS ( SELECT ST_AddBand(NULL::raster, '/home/pele/devel/geo/postgis-git/raster/test/regress/loader/Projected.tif', NULL::int[]) AS rast ) SELECT * FROM ST_BandMetadata( (SELECT rast FROM foo), ARRAY[1,3,2]::int[] ); bandnum | pixeltype | nodatavalue | isoutdb | path | outdbbandnum | filesize | filetimestamp | ---------+-----------+-------------+---------+--------------------------------------------------------------------------------+---------------+----------+---------------+- 1 | 8BUI | | t | /home/pele/devel/geo/postgis-git/raster/test/regress/loader/Projected.tif | 1 | 12345 | 1521807257 | 3 | 8BUI | | t | /home/pele/devel/geo/postgis-git/raster/test/regress/loader/Projected.tif | 3 | 12345 | 1521807257 | 2 | 8BUI | | t | /home/pele/devel/geo/postgis-git/raster/test/regress/loader/Projected.tif | 2 | 12345 | 1521807257 |