Name

ST_BandMetaData — Returns basic meta data for a specific raster band. band num 1 is assumed if none-specified.

Synopsis

(1) record ST_BandMetaData(raster rast, integer band=1);

(2) record ST_BandMetaData(raster rast, integer[] band);

Description

Returns basic meta data about a raster band. Columns returned: pixeltype, nodatavalue, isoutdb, path, outdbbandnum.

[Note]

If raster contains no bands then an error is thrown.

[Note]

If band has no NODATA value, nodatavalue are NULL.

[Note]

If isoutdb is False, path and outdbbandnum are NULL.

Examples: Variant 1

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 
---------+-----------+-------------+---------+--------------------------------------------------------------------------------+--------------
       1 | 8BUI      |             | t       | /home/pele/devel/geo/postgis-git/raster/test/regress/loader/Projected.tif      |            1
       3 | 8BUI      |             | t       | /home/pele/devel/geo/postgis-git/raster/test/regress/loader/Projected.tif      |            3
       2 | 8BUI      |             | t       | /home/pele/devel/geo/postgis-git/raster/test/regress/loader/Projected.tif      |            2
				

Examples: Variant 2

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

See Also

ST_MetaData, ST_BandPixelType