All Products
Search
Document Center

AnalyticDB:ST_MetaData

Last Updated:Mar 28, 2026

Returns the metadata of a raster object. When called with only a raster object, returns all metadata as a JSON object. When called with a key, returns the value of that metadata item as text.

Syntax

text ST_MetaData(raster raster_obj);
text ST_MetaData(raster raster_obj, text key);
text ST_MetaData(raster raster_obj, integer band, text key);

Parameters

ParameterTypeDescription
raster_objrasterThe raster object.
bandintegerThe band index, starting from 0. Used to retrieve band-level metadata.
keytextThe name of the metadata item to retrieve. Set to all to return all metadata items as a JSON object.

The three overloads address two scopes of metadata:

  • Raster-level metadata (first and second overloads): metadata associated with the raster object as a whole.

  • Band-level metadata (third overload): metadata specific to a single band within the raster object.

Examples

Get all raster-level metadata

Returns all metadata associated with the raster object as a JSON object.

SELECT ST_MetaData(raster_obj)
FROM raster_table;

Output:

      st_metadata
-----------------------
{"AREA_OR_POINT":"Area"}
AREA_OR_POINT indicates whether a pixel value represents a sampling over the pixel region (Area) or a point sample at the pixel center (Point).

Get a specific raster-level metadata item

Pass a key name to retrieve a single metadata value. The return type is text, not JSON.

SELECT ST_MetaData(raster_obj, 'swh#scale_factor')
FROM raster_table;

Output:

      st_metadata
-----------------------
 0.0001488117874873806
scale_factor is a Climate and Forecast (CF) Conventions attribute that defines the factor by which stored integer values are multiplied to obtain the actual physical value.

Get all metadata for a band

Pass the band index and all as the key to retrieve all metadata for that band.

SELECT ST_MetaData(raster_obj, 0, 'all')
FROM raster_table;

Output:

{"add_offset":"4.907141431495487","long_name":"Significant height of combined wind waves and swell","missing_value":"-32767","NETCDF_DIM_time":"1043112","NETCDF_VARNAME":"swh","scale_factor":"0.0001488117874873806","units":"m","_FillValue":"-32767"}

Common keys in this output:

KeyDescription
long_nameHuman-readable name for the variable.
unitsPhysical unit of the variable values (for example, m for meters).
scale_factorMultiplier applied to stored values to get physical values.
add_offsetValue added after applying scale_factor.
missing_value / _FillValueSentinel value indicating missing or fill data.
NETCDF_VARNAMEOriginal variable name from the NetCDF source file.
NETCDF_DIM_timeTime dimension coordinate value from the NetCDF source.

Get a specific metadata item for a band

Pass the band index and a key name to retrieve one metadata value for that band.

SELECT ST_MetaData(raster_obj, 0, 'NETCDF_DIM_time')
FROM raster_table;

Output:

 st_metadata
-------------
 1043112