All Products
Search
Document Center

PolarDB:ST_HMTAsRaster

Last Updated:Mar 28, 2026

Converts a protobuf-encoded heatmap tile into a raster object for visualization and computation.

Syntax

raster ST_HMTAsRaster(bytea hmt, text storageOption default '{}');

Parameters

ParameterDescription
hmtThe heatmap tile binary encoded in protobuf. Generate this value using ST_AsHMT.
storageOptionThe storage parameters for the raster object. If chunk_table is not specified, an anonymous temporary table is used. For details, see ST_CreateRast. Default value: {}.

Usage notes

  • The spatial reference of the input heatmap tile must match the spatial reference of the output raster.

  • Heatmap tiles are generated by ST_AsHMT. Pass the output of ST_AsHMT directly as the hmt argument.

Examples

The following example creates a test table with geometry points, generates a heatmap tile using ST_AsHMT, and converts it to a raster object using ST_HMTAsRaster.

CREATE TABLE test_table AS
SELECT i num,
    ST_setSRID(st_makepoint((i-0.5)::numeric, (i-0.5)::numeric), 4326) geom,
    i*100::int4 weight,
    i*i*i::float8 volume
FROM generate_series(1, 10) i;

SELECT ST_HMTAsRaster(ST_AsHMT(geom, --geometry type
    ST_MakeEnvelope(0, 0, 10, 10, 4326), -- Extent
    10,        -- Width, in pixels
    10         -- Height, in pixels
))
FROM test_table;