名称

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。

[Note]

如果栅格不包含任何波段,则会引发错误。

[Note]

如果波段没有 NODATA 值,则 nodatavalue 为 NULL。

[Note]

如果 isoutdb 为 False,则 path、outdbbandnum、filesize 和 filetimestamp 为 NULL。如果禁用了 outdb 访问,则 filesize 和 filetimestamp 也将为 NULL。

增强:2.5.0 包含了 outdb 栅格的 outdbbandnumfilesizefiletimestamp

示例:变体 1

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       |      |
                

示例:变体 2

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 |
                

另请参阅

ST_MetaDataST_BandPixelType