All Products
Search
Document Center

ApsaraDB RDS:ST_HMTAsArray

Last Updated:Feb 28, 2024

This topic describes the ST_HMTAsArray function. This function converts heatmap tiles to an array matrix-based representation for easier viewing.

Syntax

float8[][] ST_HMTAsArray(bytea hmt);

Return values

A 2D float8 array is returned, with each value representing a statistical value of the heatmap.

Parameters

Parameter

Description

hmt

The heatmap tile binary based on protobuf.

Description

This function converts heatmap tiles to an array matrix-based representation for easier viewing. Heatmap tiles are generated by using the ST_AsHMT function.

Examples

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_HMTAsArray(ST_AsHMT(geom, --geometry type
    ST_MakeEnvelope(0, 0, 10, 10, 4326), -- Extent
    10,        -- Width, in pixel
    10        -- height
))
FROM test_table;
---------
[0:9][0:9]={{1,0,0,0,0,0,0,0,0,0},{0,1,0,0,0,0,0,0,0,0},{0,0,1,0,0,0,0,0,0,0},{0,0,0,1,0,0,0,0,0,0},{0,0,0,0,1,0,0,0,0,0},{0,0,0,0,0,1,0,0,0,0},{0,0,0,0,0,0,1,0,0,0},{0,0,0,0,0,0,0,1,0,0},{0,0,0,0,0,0,0,0,1,0},{0,0,0,0,0,0,0,0,0,1}}