# 矢量数据

# 导入 CSV 文件

# 请求 URL:

  • http://host:port/heycloud/api/io/vdataset/importCsv

# 请求方式:

  • POST

# 请求 Header:

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

# 请求参数:

参数名称 可选值 类型 是否必须 默认值 说明
title - String - 数据标题
sr web-mercator | wgs-84 | cgcs-2000 | gcj-02 | bd-09 String - 选择的坐标系
fileId - String - 导入的文件 ID
encoding - String - 手动指定编码,如不指定则自动检测编码
fields - Array [Object] - 字段名和字段类型列表
├ name - String - 字段名
└ type - String - 字段类型
header - Array - 字段列表(不指定则使用 CSV 文件的第一行)
xName - String 'x' 作为 x 坐标的字段
yName - String 'y' 作为 y 坐标的字段
dataFrom - Number 1 从第几行开始为数据

# 请求示例:

POST http://host:port/heycloud/api/io/vdataset/importCsv

{
  sr: "wgs-84",
  title: "abnormal.csv",
  fileId: "xxxxxxx",
  fields: [{"name": "id", "type": "int"}],
  xName: "x",
  yName: "y",
}

# 正确响应示例:

{
  "result": {
    "notifyAt": "2021-02-04T10:15:13.189Z",
    "title": "abnormal.csv",
    "vdatasetId": "176fbb2b-5537-4f63-a6f7-b7d7d4dec53e"
  }
}

# 错误响应示例:

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

# 导入一张 Excel 表

# 请求 URL:

  • http://host:port/heycloud/api/io/vdataset/importExcelSheet

# 请求方式:

  • POST

# 请求 Header:

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

# 请求参数:

参数名称 可选值 类型 是否必须 默认值 说明
sr web-mercator | wgs-84 | cgcs-2000 | gcj-02 | bd-09 String - 选择的坐标系
title - String - 数据标题
fileId - String - 导入的文件 ID
fields - Array [Object] - 字段名和字段类型列表
├ name - String - 字段名
└ type - String - 字段类型
sheetName - String - 要导入的表名
xName - String 'x' 作为 x 坐标的字段
yName - String 'y' 作为 y 坐标的字段
header - Array - 字段列表(不指定则使用表的第一行作为 header)
dataFrom - Number - 从第几行开始为数据

# 请求示例:

POST http://host:port/heycloud/api/io/vdataset/importExcelSheet

{
  sr: "wgs-84",
  title: "Excel工作表",
  fileId: "xxxxxxx",
  sheetName: "工作表1",
  fields: [{"name": "id", "type": "int"}],
  xName: "x",
  yName: "y",
}

# 正确响应示例:

{
  "result": {
    "notifyAt": "2021-02-04T10:15:13.189Z",
    "title": "Excel工作表",
    "vdatasetId": "176fbb2b-5537-4f63-a6f7-b7d7d4dec53e"
  }
}

# 错误响应示例:

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

# 导入一个矢量数据集

# 请求 URL:

  • http://host:port/heycloud/api/io/vdataset/importFeatureLayer

# 请求方式:

  • POST

# 请求 Header:

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

# 请求参数:

参数名称 可选值 类型 是否必须 默认值 说明
sr web-mercator | wgs-84 | cgcs-2000 | gcj-02 | bd-09 String - 选择的坐标系
title - String - 数据标题
fileId - String - 导入的文件 ID
layerId - Number - 选择的图层
encoding - String - 手动指定编码,如不指定则自动检测编码,指定编码只对 Shapefile 和 DXF 数据有效

# 请求示例:

POST http://host:port/heycloud/api/io/vdataset/importFeatureLayer

{
  sr:"gcj-02",
  title: "北京街区 2020",
  fileId: "xxxxxxx",
  layerId: 0
}

# 正确响应示例:

{
  "result": {
    "vdatasetId": "0b1dae11-36df-4884-bc33-f340850f9890",
    "title": "北京街区 2020",
    "notifyAt": "2021-03-10T07:33:16.346Z"
  }
}

# 错误响应示例:

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

# 即时导入一个 GeoJSON

# 请求 URL:

  • http://host:port/heycloud/api/io/vdataset/instantImportGeoJSON

# 请求方式:

  • POST

# 请求 Header:

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

# 请求参数:

参数名称 可选值 类型 是否必须 默认值 说明
title - String - 数据标题
sr web-mercator | wgs-84 | cgcs-2000 | gcj-02 | bd-09 String - 导入数据的坐标系
fields - Object - 如指定 fields 则只导入其中包含的字段(指定类型),否则导入所有字段(自动推断类型)
data - Object - 导入的 GeoJSON 内容,该数据内容必须是 FeatureCollection 类型

# 请求示例:

POST http://host:port/heycloud/api/io/vdataset/instantImportGeoJSON

{
  title: "即时导入的数据标题",
  sr:"wgs-84",
  fields: [{"name": "id", "type": "int"}],
  data: { "type": "FeatureCollection", "features": [...]}
}

# 正确响应示例:

{
  "result": {
    "vdatasetId": "0b1dae11-36df-4884-bc33-f340850f9890",
    "title": "即时导入的数据标题",
    "importedAt": "2021-03-10T07:33:16.346Z"
  }
}

# 错误响应示例:

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

# 获取导入中的矢量数据集信息

# 请求 URL:

  • http://host:port/heycloud/api/io/vdataset/importing

# 请求方式:

  • GET

# 请求 Header:

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

# 请求参数:

参数名称 类型 是否必须 默认值 说明
sortField String startAt 用于排序的字段
sortType String asc 排序的类型
limit Number 10 最多返回的数据项,用于显示部分还没结束的导入进程

# 请求示例:

GET http://host:port/heycloud/api/io/vdataset/importing

# 正确响应示例:

{
  "result": {
    "total": "1",
    "rows": [
      {
        "vdatasetId": "0e865ff1-ac68-4e26-87e2-ed872ed0e98d",
        "accountId": "",
        "type": "excel-Sheet1",
        "fileId": "3b8d1c55ed70093f1abdb3a191e4c99f",
        "srcVdatasetId": null,
        "importedCount": "0",
        "startAt": "2021-03-10T07:40:55.433Z"
      }
    ]
  }
}

# 错误响应示例:

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

# 取消导入操作

# 请求 URL:

  • http://host:port/heycloud/api/io/vdataset/importing/:vdatasetId/cancel

# 请求方式:

  • POST

# 请求 Header:

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

# 请求参数:

参数名称 类型 是否必须 默认值 说明
vdatasetId String - 数据集 ID

# 请求示例:

POST http://host:port/heycloud/api/io/vdataset/importing/xxxxx/cancel

# 正确响应示例:

{
  "result": {
    "id": "0e865ff1-ac68-4e26-87e2-ed872ed0e98d",
    "cancelledAt": "2021-03-10T07:41:33.717Z"
  }
}

# 错误响应示例:

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

# 获取导入的矢量数据信息

# 请求 URL:

  • http://host:port/heycloud/api/io/vdataset/:vdatasetId

# 请求方式:

  • POST

# 请求 Header:

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

# 请求参数:

参数名称 类型 是否必须 默认值 说明
vdatasetId String - 数据集 ID

# 请求示例:

POST http://host:port/heycloud/api/io/vdataset/xxxxx

# 正确响应示例:

表示正在上传

{
  "result": {
    "importing": {
      "vdatasetId": "0e865ff1-ac68-4e26-87e2-ed872ed0e98d",
      "type": "excel-Sheet1",
      "fileId": "3b8d1c55ed70093f1abdb3a191e4c99f",
      "startAt": "2021-03-10T07:40:55.433Z",
      "importedCount": "96257" // 已上传数据
    }
  }
}

表示上传成功

{
  "result": {
    "id": "774ee29b-623b-498f-9d4c-20f654256009",
    "title": "sixOut",
    "sr": "wgs-84",
    "count": "7",
    "createdAt": "2021-03-10T07:49:08.957Z"
  }
}

# 错误响应示例:

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

# 将无主数据分配给某个帐号

# 请求 URL:

http://host:port/heycloud/api/io/vdataset/:vdatasetId/assign

# 请求方式:

  • POST

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 通过 session 提供管理权限

# 请求参数:

参数名称 类型 是否必须 默认值 说明
vdatasetId String - 数据集 ID
accountId String - 账号

# 请求示例:

POST http://host:port/heycloud/api/io/vdataset/xxxxx/assign

{
  accountId: "xxxxxx"
}

# 正确响应示例:

{
  "result": {
    "id": "68ee1874-0a86-47dd-befa-8b2328d3f64b",
    "assingnedAt": "2021-02-04T09:46:34.465Z"
  }
}

# 错误响应示例:

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

# 复制矢量数据集

# 请求 URL:

  • http://host:port/heycloud/api/io/vdataset/:vdatasetId/duplicate

# 请求方式:

  • POST

# 请求 Header:

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

# 请求参数:

参数名称 类型 是否必须 默认值 说明
vdatasetId String - 数据集 ID

# 请求示例:

POST http://host:port/heycloud/api/io/vdataset/xxxxx/duplicate

# 正确响应示例:

{
  "result": {
    "vdatasetId": "774ee29b-623b-498f-9d4c-20f654256009",
    "newVdatasetId": "96359aab-2be7-4fec-9bb3-f32c06b3d72c",
    "notifyAt": "2021-03-10T07:57:50.782Z"
  }
}

# 错误响应示例:

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

# 导出矢量数据集

# 请求 URL:

  • http://host:port/heycloud/api/io/vdataset/:vdatasetId/export

# 请求方式:

  • POST

# 请求 Header:

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

# 请求参数:

参数名称 类型 是否必须 默认值 说明
vdatasetId String - 数据集 ID
format String GeoJSON 文件导出格式
ignoreExist Boolean - 忽略已存在的导出文件

# 请求示例:

POST http://host:port/heycloud/api/io/vdataset/xxxxx/export

{
  format: "xxx",
  ignoreExist: true,
}

# 正确响应示例:

{
  "result": {
    "fileId": "e29fa6e33c9ba3787a639566d9a10157",
    "suffix": "geojson",
    "vdatasetId": "f94cbe0f-0e6c-4e61-8e59-9a8b3b2126c2",
    "accountId": "",
    "revision": "1",
    "notifyAt": "2021-03-10T08:04:50.014Z"
  }
}

# 错误响应示例:

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

# 取消导出操作

# 请求 URL:

  • http://host:port/heycloud/api/io/vdataset/exporting/:fileId/cancel

# 请求方式:

  • POST

# 请求 Header:

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

# 请求参数:

参数名称 类型 是否必须 默认值 说明
fileId String - 导出的文件 ID

# 请求示例:

POST http://host:port/heycloud/api/io/vdataset/exporting/xxxxx/cancel

# 正确响应示例:

{
  "result": {
    "id": "82ee26e389459dca7755c3b20abfa408",
    "cancelledAt": "2021-03-10T08:09:16.844Z"
  }
}

# 错误响应示例:

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

# 返回导出文件的信息

# 请求 URL:

  • http://host:port/heycloud/api/io/vdataset/export/:fileId

# 请求方式:

  • GET

# 请求 Header:

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

# 请求参数:

参数名称 类型 是否必须 默认值 说明
fileId String - 导出的文件 ID

# 请求示例:

GET http://host:port/heycloud/api/io/vdataset/export/xxxxx

# 正确响应示例:

正在导出

{
  "result": {
    "exporting": {
      "fileId": "e29fa6e33c9ba3787a639566d9a10157",
      "suffix": "geojson",
      "vdatasetId": "f94cbe0f-0e6c-4e61-8e59-9a8b3b2126c2",
      "accountId": "",
      "revision": "1",
      "startAt": "2021-03-10T08:04:49.911Z",
      "exportedCount": "400"
    }
  }
}

完成导出

{
  "result": {
    "fileId": "e29fa6e33c9ba3787a639566d9a10157",
    "suffix": "geojson",
    "vdatasetId": "f94cbe0f-0e6c-4e61-8e59-9a8b3b2126c2",
    "accountId": "",
    "revision": "1",
    "exportedCount": "400",
    "startAt": "2021-03-10T08:04:49.911Z",
    "createdAt": "2021-03-10T08:04:54.255Z"
  }
}

# 错误响应示例:

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

# 下载导出的文件

# 请求 URL:

  • http://host:port/heycloud/api/io/vdataset/export/:fileId/download

# 请求方式:

  • GET

# 请求 Header:

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

# 请求参数:

参数名称 类型 是否必须 默认值 说明
fileId String - 导出的文件 ID

# 请求示例:

GET http://host:port/heycloud/api/io/vdataset/export/xxxxx/download

# 正确响应示例:

该请求成功后返回的是文件的流对象,直接将请求链接在浏览器中打开即可提示下载文件。

# 错误响应示例:

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

# 删除一个矢量数据集

# 请求 URL:

  • http://host:port/heycloud/api/io/vdataset/:vdatasetId

# 请求方式:

  • DELETE

# 请求 Header:

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

# 请求参数:

参数名称 类型 是否必须 默认值 说明
vdatasetId String - 数据集 ID

# 请求示例:

DELETE http://host:port/heycloud/api/io/vdataset/xxxxx

# 正确响应示例:

{
  "result": {
    "id": "ec3a2d35-24aa-4559-be2a-78429a2a50d9",
    "deletedAt": "2021-03-10T08:15:49.166Z"
  }
}

# 错误响应示例:

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