Converts a protobuf-encoded heatmap tile into a raster object for visualization and computation.
Syntax
raster ST_HMTAsRaster(bytea hmt, text storageOption default '{}');Parameters
| Parameter | Description |
|---|---|
hmt | The heatmap tile binary encoded in protobuf. Generate this value using ST_AsHMT. |
storageOption | The 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 ofST_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;