# 渲染底图

# 列出所有底图的名称

# 请求 URL:

  • http://host:port/heycloud/api/render/basemap/list

# 请求方式:

  • GET

# 请求示例:

GET http://host:port/heycloud/api/render/basemap/list

# 正确响应示例:

{
  "result": ["sample", "china"]
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息"
}

# 按瓦片索引返回矢量瓦片数据

# 请求 URL:

  • http://host:port/heycloud/api/render/basemap/:mapName/:z/:x/:y/vtile.:format

# 请求方式:

  • GET

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-vtile-config String JSON 格式的矢量瓦片的配置,如 "{dataMaxZoom: 14, tiling: {...}}",默认 dataMaxZoom=14(大于 14 的级别都采用 14 级的数据),tiling 为 Google 瓦片分级

# 请求参数:

# Params&Query:
字段 类型 说明
mapName String 底图的名字
z String 瓦片的层级
x String 瓦片 x 方向的索引
y String 瓦片 y 方向的索引
format String 矢量瓦片格式,支持 mvt/json

# 请求示例:

GET http://host:port/heycloud/api/render/basemap/:mapName/:z/:x/:y/vtile.:format

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息"
}

# 按瓦片索引渲染为图片

# 请求 URL:

  • http://host:port/heycloud/api/render/basemap/:mapName/:z/:x/:y/:scale/:styleName.:format

# 请求方式:

  • GET

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-render-disable-cache String 如为字符串'true'则不使用缓存数据,确保为最新的渲染效果
x-heycloud-render-cache String 渲染结果的缓存时间,单位秒
x-heycloud-render-timeout String 渲染的超时时间,单位秒

# 请求参数:

# Params&Query:
字段 类型 说明
mapName String 底图的名字
z String 瓦片的层级
x String 瓦片 x 方向的索引
y String 瓦片 y 方向的索引
scale String 渲染的缩放比例,用于高清出图
styleName String 底图的样式名称,对应底图部署目录下的 styles/${styleName}.json
format String 图片格式,支持 png/jpeg/webp

# 请求示例:

GET http://host:port/heycloud/api/render/basemap/:mapName/:z/:x/:y/:scale/:styleName.:format

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息"
}

# 列出所有底图渲染样式的名称

# 请求 URL:

  • http://host:port/heycloud/api/render/basemap/style/list

# 请求方式:

  • GET

# 请求示例:

GET http://host:port/heycloud/api/render/basemap/style/list

# 正确响应示例:

{
  "result": ["dark", "default", "gray"]
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息"
}

# 获取底图样式

# 请求 URL:

  • http://host:port/heycloud/api/render/basemap/style/:styleName

# 请求方式:

  • GET

# 请求参数:

# Params&Query:
字段 类型 说明
styleName String 底图的样式名称,对应 /var/share/basemap/styles/${styleName}.json

# 请求示例:

GET http://host:port/heycloud/api/render/basemap/style/xxxxx

# 正确响应示例:

{
  "result": {...}
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息"
}

# 清理缓存的底图样式,使其重新加载最新的内容

# 请求 URL:

  • http://host:port/heycloud/api/render/basemap/style/:styleName/clear

# 请求方式:

  • POST

# 请求参数:

# Params&Query:
字段 类型 说明
styleName String 底图的样式名称,对应 /var/share/basemap/styles/${styleName}.json

# 请求示例:

POST http://host:port/heycloud/api/render/basemap/style/xxxxx/clear

# 正确响应示例:

{
  "result": { "ok": true }
}

# 错误响应示例:

{
  "error": "CLEAR_STYLE_FAILED",
  "message": "清理样式失败"
}