计算热力图瓦片统计值信息,方便在渲染时使用。
语法
record ST_HMTAsArray(bytea hmt, integer factor default 1, out float8 min, out float8 max, out float8 mean, out float8 sum , out float8 count , out float8 std, out float8 median, out float8 mode, out float8[] percentile);
返回值
返回热力图瓦片统计值信息记录,字段说明如下:
字段名称 | 描述 |
min | 最小值。 |
max | 最大值。 |
mean | 平均值。 |
sum | 数据之和。 |
count | 数据个数。 |
std | 标准差。 |
median | 中位数。 |
mode | 众数。 |
percentile | 百分比数组。总共100个数值,表示每个百分比对应的数值。 |
参数
参数名称 | 描述 |
hmt | 基于protobuf表示的HMT二进制。 |
factor | 采样比例,即每多少个数据进行统计计算。例如,factor为4,表示每4个值进行统计。 |
描述
计算热力图瓦片统计值信息,方便在渲染时使用。 热力图瓦片需要通过ST_AsHMT函数生成。
示例
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_HMTstats(ST_AsHMT(the_geom,
ST_MakeEnvelope(0, 0, 10, 10),
10,
10))).*
FROM test_table;
------------------
min | max | mean | sum | count | std | median | mode | percentile
0 | 2 | 0.19 | 19 | 100 | 0.5778408085277467 | 0 | 0 | {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2}
-- factor set to 4
SELECT (ST_HMTstats(ST_AsHMT(the_geom,
ST_MakeEnvelope(0, 0, 10, 10),
10,
10),4)).*
FROM test_table;
------------------
min | max | mean | sum | count | std | median | mode | percentile
0 | 2 | 0.16 | 4 | 25 | 0.5425863986500215 | 0 | 0 | {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2}
文档内容是否对您有帮助?