矢量金字塔
ST_BuildPyramid
生成概化数据
语法
boolean ST_BuildPyramid(schemaname text, tablename text, columnname text, config text)
参数:
   schemaname: 数据表所在的模式名称
   tablename: 数据表名称(必须包含有 geometry 数据)
   columnname: geometry 列名称
   config: 配置说明,是一个 JSON 格式的配置说明,其中包括:
      +  level: 要生成的层级,必选项
      +  resolution: 要简化的分辨率,
      +  simplify: 简化参数,tolerance 与 resolution 一致,preserveCollapsed 是否保留较小对象。
      +  attribute: 要包含的属性的数组。
返回值:
   如果成功则返回 true , 否则返回 false
示例:
select ST_BuildPyramid('public','nanning',
                       'smgeometry',
                       '[
    {
        "level": 12,
        "resolution":12.0,
        "simplify": {
            "tolerance": 0.00002,
            "preserveCollapsed": true
        },
        "attribute": [
            "smid"
        ]
    }
]');
-- 对 nanning 这个表生成层级为 12 的概化数据,并包含 smid 属性,简化容限为 0.00002,并保留最小对象
ST_BuildTile
生成矢量瓦片数据
语法:
boolean ST_BuildTile(schemaname text, tablename text, columnname text, maxlevel int)
参数:
   schemaname: 数据表所在的模式名称
   tablename: 表名(必须包含 geometry 数据 )
   columnname: geomodel 列名
   maxlevel: 矢量瓦片数据最大层级
返回值:
   如果成功则返回 true , 否则返回 false
示例:
select ST_BuildTile('public','nanning',
                    'smgeometry', 12);
-- 对 nanning 的数据集,生成 12 层级的矢量瓦片
ST_HasPyramid
查看是否存在矢量金字塔数据
语法:
boolean ST_HasPyramid(schemaname text, table_name text, column_name text)
参数:
   schemaname: 数据表所在的模式名称
   table_name: 表名
   column_name: 列名
返回值:
   如果有矢量金字塔数据,则返回 true, 否则返回  false
示例:
select ST_HasPyramid('public', 'nanning', 'smgeometry');
ST_ListPyramid
返回矢量金字塔的配置
语法:
SETOF text ST_ListPyramid(schemaname text, tablename text, columnname text)
参数:
   schemaname: 数据表所在的模式名称
   table_name: 表名
   column_name: 列名
返回值:
   具体的金字塔配置
示例:
select ST_ListPyramid('public', 'nanning', 'smgeometry');
ST_DeletePyramid
删除矢量金字塔
语法:
void ST_DeletePyramid(schemaname text, tablename text, columnname text)
参数:
   schemaname: 数据表所在的模式名称
   table_name: 表名
   column_name: 列名
返回值:
   无
示例:
select ST_DeletePyramid('public', 'nanning', 'smgeometry');
ST_UpdatePyramid
更新矢量金字塔
语法:
boolean ST_UpdatePyramid(schemaname text, tablename text, columnname text, updateextent box2d, maxlevel integer)
参数:
   schemaname: 数据表所在的模式名称
   table_name: 表名
   column_name: 列名
   updateextent: 数据集更新的范围
   maxlevel: 更新的最大层级
返回值:
   成功返回 true,失败返回 false
示例:
select ST_UpdatePyramid('public', 'nanning_3857', 'smgeometry',
                     'BOX(12056721.088426786 2609724.41992916,12108806.564346984 2644435.0501074973)'::box2d, 2);
ST_AsTile
更新矢量金字塔
语法:
bytea ST_AsTile(schemaname text, tablename text, columnname text, z bigint, x bigint, y bigint)
参数:
   schemaname: 数据表所在的模式名称
   table_name: 表名
   column_name: 列名
   z: 瓦片层级
   x: 瓦片横坐标
   y: 瓦片纵坐标
返回值:
   瓦片数据
示例:
select ST_AsTile('public', 'nanning_3857', 'smgeometry',7, 102, 55);
Yukon_Pyramid_Version
返回 pyramid 模块的编译时间和版本信息
语法:
text yukon_pyramid_version()
示例:
select yukon_pyramid_version();
-- 输出
yukon_pyramid 1.0.0 Compiled at: 2023-04-17 17:30:23 Commit ID:c3ab309