Converts a heatmap tile binary into a raster object for visualization and further computation.
Syntax
raster ST_HMTAsRaster(bytea hmt, text storageOption default '{}');Parameters
| Parameter | Description |
|---|---|
hmt | The heatmap tile binary encoded in protobuf. To generate this value, use ST_AsHMT. |
storageOption | The storage parameters for the raster object. If chunk_table is not specified, an anonymous temporary table is used. Default value: {}. For details, see ST_CreateRast. |
Usage notes
The spatial reference (SRID) of the input heatmap tile must match the spatial reference of the output raster.
Pass the output of
ST_AsHMTdirectly as thehmtargument.
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;