# 渲染瓦片数据

比如将矢量瓦片集进行渲染

# 配置渲染参数

# 请求 URL:

  • http://host:port/heycloud/api/render/tiles

# 请求方式:

  • POST

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 通过 session 提供管理权限
x-heycloud-account-id String 帐号的唯一标识符
x-heycloud-render-expire String 渲染配置的过期时间,单位秒

# 请求参数:

# Content type: application/json
字段 可选值 类型 是否必选 说明
datasource - Object
├ type vdataset | idataset String 瓦片的类型
├ attrFields 通过 meta 接口获取 Array 否(style.type 为非 simple 时必选) 渲染的字段
└ source - String 瓦片的唯一标识
vtileConfig 参考详细的样式说明 Object 样式设置
├ layers - Object
└ data String 数据
└ style 参考详细的样式说明 Object 填充样式

# 请求示例:

POST http://host:port/heycloud/api/render/tiles

{
  "datasource":
  {
    "type": "vtileset",
    "source": "23d3613d-3001-4b9b-8ffa-db7cf57744f8"
  },
  "vtileConfig":
  {
    "backgroundColor": "#9fd7fc",
    "layers": [
    {
      "data": "world_land",
      "style":
      {
        "type": "polygon-simple",
        "fillColor": "#f7f7f7"
      }
    }]
  }
}

# 正确响应示例:

{
  "result": {
    "uid": "xxx",
    "updatedAt": 1593702110989
  }
}

# 错误响应示例:

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

# 获取渲染参数

# 请求 URL:

  • http://host:port/heycloud/api/render/tiles/:uid

# 请求方式:

  • GET

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 通过 session 提供管理权限
x-heycloud-account-id String 帐号的唯一标识符

# 请求参数:

# Params&Query:
字段 类型 说明
uid String 渲染配置的唯一标识,配置的变化会导致 uid 的变化

# 请求示例:

GET http://host:port/heycloud/api/render/tiles/xxxxx

# 正确响应示例:

{
  "result": {...}
}

# 错误响应示例:

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

# 更新渲染参数的过期时间

# 请求 URL:

  • http://host:port/heycloud/api/render/tiles/:uid

# 请求方式:

  • POST

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 通过 session 提供管理权限
x-heycloud-account-id String 帐号的唯一标识符
x-heycloud-render-expire String 渲染配置的过期时间,单位秒

# 请求参数:

# Params&Query:
字段 类型 说明
uid String 渲染配置的唯一标识,配置的变化会导致 uid 的变化

# 请求示例:

POST http://host:port/heycloud/api/render/tiles/xxxxx

# 正确响应示例:

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

# 错误响应示例:

{
  "error": "UPDATE_EXPIRE_FAILED",
  "message": "更新过期时间失败"
}

# 按瓦片索引渲染为图片

# 请求 URL:

  • http://host:port/heycloud/api/render/tiles/:uid/:z/:x/:y/:scale/image.:format

# 请求方式:

  • GET

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 通过 session 提供管理权限
x-heycloud-account-id String 帐号的唯一标识符
x-heycloud-render-disable-cache String 如为字符串'true'则不使用缓存数据,确保为最新的渲染效果
x-heycloud-render-cache String 渲染结果的缓存时间,单位秒
x-heycloud-render-timeout String 渲染的超时时间,单位秒

# 请求参数:

# Params&Query:
字段 类型 说明
uid String 渲染配置的唯一标识,配置的变化会导致 uid 的变化
z String 瓦片的层级
x String 瓦片 x 方向的索引
y String 瓦片 y 方向的索引
scale String 渲染的缩放比例,用于高清出图
format String 图片格式,支持 png/jpeg/webp

# 请求示例:

GET http://host:port/heycloud/api/render/tiles/:uid/:z/:x/:y/:scale/image.:format

# 正确响应示例:

{image/*}

# 错误响应示例:

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