SuperAPI AI 工具集

carto-hotspot-analysis

数据与分析

查看项目

更新于 10-15 18:46

技能介绍

用途:在 CARTO 中构建 Getis-Ord Gi* 热点分析工作流,识别统计显著的空间聚集(热点为正、冷点为负)。触发词包括 hotspots、coldspots、spatial clusters、Getis-Ord、Gi*、cluster 等。

前置:需先加载 carto-create-workflow,了解开发流程、JSON 结构与校验命令,其覆盖 MCP 工作流工具(create_workflow、validate_workflow、run_workflow)与 carto workflows CLI 两条路径。

标准流水线:Source Data →(Filter)→ Spatial Indexing → Aggregation → Getis-Ord Gi* →(Filter Significant)→ Save。各步使用 native.gettablebyname、native.wheresimplified/native.where、native.h3polyfill 或 native.h3frompoint/native.quadbinfromgeopoint、native.groupby、native.getisord、native.where、native.saveastable。

网格与分辨率:优先对研究区边界做 polyfill 生成无缺口网格再聚合,使每格都有值(无数据填 0),避免邻域计算失真;无边界时可直接由点生成格网。H3 res 7 约 5km(区/市级)、res 8 约 2km(邻里级)、res 9 约 500m(街道级)。Getis-Ord 参数:indexcol 默认 h3,valuecol 默认 h3_count,kernel 支持 uniform/triangular/quadratic/quartic/gaussian(默认 uniform),size 为 K 环半径(默认 3,越大越平滑)。输出列:index、gi(z 分数)、p_value;筛选常用 p_value<0.05,gi>0 仅热点,gi<0 仅冷点。

时空变体:native.getisordspacetime 增加时间维度(kerneltime、bandwidth、timeinterval),数据需预先按时间分箱;native.spacetimehotspotsclassification 接在其后,分类为 new hotspot、consecutive、intensifying、diminishing、sporadic、oscillating、historical;native.timeseriesclustering 按时间模式聚类(profile 或 value),可用 ≥60% 时间步 p_value<0.05 的启发式过滤。注意分类前不要按 p_value 过滤,否则趋势检验数据不全。

限制与注意:Getis-Ord 组件需 Analytics Toolbox,离线校验无法解析其位置,需先运行 carto workflows verify-remote --connection <conn>;Snowflake 未加引号标识符为大写(H3、INDEX、GI、P_VALUE、H3_COUNT);输出列名为 index 而非 h3/quadbin,如需回连原数据须重命名;native.h3boundary 生成列名为 <h3col>_geo;valuecol 必须为数值;分辨率过高加大区域可能慢或超内存;筛选结果为空通常因 K 环过小或数据过稀疏,可增大 size 或降低分辨率;时空分析日期列须为 DATETIME,bandwidth=1 检测快速变化、3 以上平滑长期趋势。参考模板:poi_hotspot.json、space_time_hotspot.json、spacetime_hotspot_classification.json。具体价格、平台覆盖等资料暂未提供。