获取地图元素

2024-12-20
暂无评分

获取元素列表

PILOT在首次上线后,会发送http请求去获取地图元素列表,服务端需要把共享的地图元素列表发给PILOT。同时,当接收到websocket指令进行图层刷新的时候,也是需要调用该接口进行请求地图元素列表。

注意:列表里需要有App共享图层,否则后继元素修改将无法同步到服务器。 GET /map/api/v1/workspaces/{workspace_id}/element-groups

Parameters

NameInTypeRequiredDescription
group_idquerystringfalse元素组id(同一个元素组下可以包含多个地图元素,相当于给地图元素进行分组。在发起请求时,如果不带group_id参数,则服务端会把所有地图元素全部返回,如果指定了group_id,则只会返回指定的元素组内的元素集合)
is_distributedquerybooleanfalse元素组分发状态(默认为true)
workspace_idpathstringtrue工作空间id
x-auth-tokenheaderstringtrue访问令牌

Responses

StatusMeaningDescriptionSchema
200OKopen in new windowOKmap.SwagTree

Example responses

{
    "code":0,
    "message":"success",
    "data":[
        {
            "id":"d275c4e1-d864-4736-8b5d-5f5882ee9bdd",
            "type":1,
            "name":"string",
            "is_lock":false,
            "create_time":1637158501230,
            "elements":[
                {
                    "id":"6d5da7b4-ac39-42bf-9580-4c8a94c11989",
                    "name":"string",
                    "create_time":1637158501230,
                    "update_time":1637158501230,
                    "resource":{
                        "type":0,
                        "user_name":"name",
                        "content":{
                            "type":"Feature",
                            "properties":{
                                "color":"#0091FF",
                                "clampToGround":false
                            },
                            "geometry":{
                                "type":"Point",
                                "coordinates":[
                                    -112.49344909640939,
                                    48.18734850103778,
                                    40.2
                                ]
                            }
                        }
                    }
                },
                {
                    "id":"6d5da7b4-ac39-42bf-9580-4c8a94c11988",
                    "name":"string",
                    "create_time":1637158501230,
                    "update_time":1637158501230,
                    "resource":{
                        "type":1,
                        "user_name":"string",
                        "content":{
                            "type":"Feature",
                            "properties":{
                                "color":"#0091FF",
                                "clampToGround":false
                            },
                            "geometry":{
                                "type":"LineString",
                                "coordinates":[
                                    [
                                        -112.49344909640939,
                                        48.18734850103778
                                    ],
                                    [
                                        -104.47267952618783,
                                        46.60029335386577
                                    ],
                                    [
                                        -109.20285386177949,
                                        42.63945392538244
                                    ],
                                    [
                                        -113.51847222524307,
                                        43.059268439796575
                                    ]
                                ]
                            }
                        }
                    }
                },
                {
                    "id":"6d5da7b4-ac39-42bf-9580-4c8a94c11987",
                    "name":"string",
                    "create_time":1637158501230,
                    "update_time":1637158501230,
                    "resource":{
                        "type":2,
                        "user_name":"string",
                        "content":{
                            "type":"Feature",
                            "properties":{
                                "color":"#0091FF",
                                "clampToGround":false
                            },
                            "geometry":{
                                "type":"Polygon",
                                "coordinates":[
                                    [
                                        [
                                            -112.49344909640939,
                                            48.18734850103778
                                        ],
                                        [
                                            -104.47267952618783,
                                            46.60029335386577
                                        ],
                                        [
                                            -109.20285386177949,
                                            42.63945392538244
                                        ],
                                        [
                                            -113.51847222524307,
                                            43.059268439796575
                                        ]
                                    ]
                                ]
                            }
                        }
                    }
                }
            ]
        }
    ]
}

Schemas

map.SwagTree

{
  "code": 0,
  "data": [
    {
      "create_time": 0,
      "elements": [
        {
          "create_time": 0,
          "id": "string",
          "name": "string",
          "resource": {
            "content": {
              "geometry": {
                "coordinates": [
                  null
                ],
                "type": "text"
              },
              "properties": {
                "clampToGround": true,
                "color": "string"
              },
              "type": "text"
            },
            "type": 0
          },
          "update_time": 0
        }
      ],
      "id": "string",
      "is_lock": true,
      "name": "string",
      "type": 0
    }
  ],
  "message": "string"
}

Properties

NameTypeRequiredRestrictionsDescription
codeintegerfalsenone错误码
data[map.ElementGroupOutput]falsenonenone
messagestringfalsenone错误描述

map.ElementGroupOutput

{
  "create_time": 0,
  "elements": [
    {
      "create_time": 0,
      "id": "string",
      "name": "string",
      "resource": {
        "content": {
          "geometry": {
            "coordinates": [
              null
            ],
            "type": "text"
          },
          "properties": {
            "clampToGround": true,
            "color": "string"
          },
          "type": "text"
        },
        "type": 0
      },
      "update_time": 0
    }
  ],
  "id": "string",
  "is_lock": true,
  "name": "string",
  "type": 0
}

Properties

NameTypeRequiredRestrictionsDescription
create_timeintegerfalsenone元素组创建时间(毫秒)
elements[map.ElementItem]falsenone元素集合
idstringfalsenone元素组id
is_lockbooleanfalsenone是否锁定 (若锁定,则该元素组下的元素不可进行删除和修改)
namestringfalsenone元素组名称
typeintegerfalsenone元素组类型
* 0 - 自定义元素组
* 1 - 默认元素组
* 2 - App 共享元素组(type=2 时是 App 共享元素组,Pilot 默认会往这个元素组增加地图)

map.ElementItem

{
  "create_time": 0,
  "id": "string",
  "name": "string",
  "resource": {
    "content": {
      "geometry": {
        "coordinates": [
          null
        ],
        "type": "text"
      },
      "properties": {
        "clampToGround": true,
        "color": "string"
      },
      "type": "text"
    },
    "type": 0
  },
  "update_time": 0
}

Properties

NameTypeRequiredRestrictionsDescription
create_timeintegerfalsenone元素创建时间(毫秒)
idstringfalsenone元素id
namestringfalsenone元素名称
resourcemap.ResourceItemfalsenone资源对象
update_timeintegerfalsenone元素更新时间(毫秒)

map.ResourceItem

{
  "content": {
    "geometry": {
      "coordinates": [
        null
      ],
      "type": "text"
    },
    "properties": {
      "clampToGround": true,
      "color": "string"
    },
    "type": "text"
  },
  "type": 0
}

Properties

NameTypeRequiredRestrictionsDescription
contentmap.Contentfalsenone资源内容对象
typeintegerfalsenone资源类型
* 0 - pin点
* 1 - 线
* 2 - 面

map.Content

{
  "geometry": {
    "coordinates": [
      null
    ],
    "type": "text"
  },
  "properties": {
    "clampToGround": true,
    "is3d": false,
    "color": "string"
  },
  "type": "text"
}

Properties

NameTypeRequiredRestrictionsDescription
geometryobjectfalsenonegeojson属性
» coordinates[any]falsenonegeojson属性
» typestringfalsenonegeojson属性
propertiesobjectfalsenonegeojson属性
» clampToGroundbooleanfalsenone是否贴地
» is3dbooleanfalsenone是否为空间线面
» colorstringfalsenone支持的元素颜色
* BLUE:0x2D8CF0
* GREEN - 0x19BE6B

* YELLOW - 0xFFBB00

* ORANGE - 0xB620E0

* RED - 0xE23C39
* PURPLE - 0x212121
typestringfalsenonegeojson属性
若您对文档有意见或疑惑,点击可快速反馈,我们会与您联系。