Name

ST_BandMetaData — 返回特定栅格波段的基本元数据。 如果未指定,则假定波段编号为 1。

Synopsis

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

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

[Note]

如果 isoutdb 为 False,则路径、outdbbandnum、文件大小和文件时间戳为 NULL。 如果禁用 outdb 访问,则文件大小和文件时间戳也将为 NULL。

增强:2.5.0 包括 outdbbandnum文件大小文件时间戳 for outdb 栅格。

示例:格式 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 |