跳到主要内容

获取地图元素

获取元素列表

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
200OKOKmap.SwagTree

Example responses

{
"code": 0,
"message": "success",
"data": [
{
"id": "e3dea0f5-37f2-4d79-ae58-490af3228060",
"name": "Pilot Share Layer",
"type": 2,
"elements": [
{
"primaryId": "183",
"id": "2b96863e-849b-4a9f-a254-93815d73ee19",
"name": "D.11.15103743",
"operType": 0,
"resource": {
"type": 0,
"content": {
"type": "Feature",
"properties": {
"color": "#03FEF4",
"clampToGround": false
},
"geometry": {
"type": "Point",
"coordinates": [
113.99765962942968,
22.595632168503897,
null
]
}
},
"user_name": "THtest234567"
},
"create_time": "1718089837166",
"update_time": "1718089837166",
"obj_type": 0,
"description": "",
"role": 0,
"flag": "1",
"site_id": "173115462753587200"
},
{
"primaryId": "115",
"id": "a39a5fae-1685-4e0c-a309-e72ca5595d2d",
"name": "A.17.174255",
"operType": 0,
"resource": {
"type": 2,
"content": {
"type": "Feature",
"properties": {
"color": "#03FEF4",
"clampToGround": true
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
114.05516401,
23.154524
],
[
114.05361481,
23.15329307
],
[
114.05709191,
23.1533249
],
[
114.05690832,
23.15478928
],
[
114.05570337,
23.1551819
]
]
]
}
},
"user_name": "R22254"
},
"create_time": "1715938986559",
"update_time": "1716022600797",
"obj_type": 0,
"description": "",
"role": 0,
"space": 0,
"flag": "0",
"site_id": "173115462753587200"
},
{
"primaryId": "3",
"id": "fe5636ed-eaab-468e-ad76-422a08e38f22",
"name": "A.24.142518",
"operType": 0,
"resource": {
"type": 2,
"content": {
"type": "Feature",
"properties": {
"color": "#03FEF4",
"clampToGround": true
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
114.06633825,
22.5896784
],
[
114.0649723,
22.58263576
],
[
114.07748006,
22.58270984
],
[
114.07617298,
22.58997173
],
[
114.07617342,
22.58997169
]
]
]
}
},
"user_name": "admin"
},
"create_time": "1713939928354",
"update_time": "1713939928354",
"obj_type": 0,
"description": "",
"role": 0,
"space": 0,
"flag": "0",
"site_id": "173797324241113088"
}
],
"is_lock": false
},
{
"id": "e3dea0f5-37f2-4d79-ae58-490af3228011",
"name": "Default Layer",
"type": 1,
"elements": [

],
"is_lock": false
}
]
}

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元素组类型<br>* 0 - 自定义元素组<br>* 1 - 默认元素组<br>* 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资源类型<br>* 0 - pin点<br>* 1 - 线<br>* 2 - 面

map.Content

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

Properties

NameTypeRequiredRestrictionsDescription
geometryobjectfalsenonegeojson属性
» coordinates[any]falsenonegeojson属性
» typestringfalsenonegeojson属性
propertiesobjectfalsenonegeojson属性
» clampToGroundbooleanfalsenone是否贴地
» colorstringfalsenone支持的元素颜色<br>* BLUE:0x2D8CF0<br>* GREEN - 0x19BE6B<br><br>* YELLOW - 0xFFBB00<br><br>* ORANGE - 0xB620E0<br><br>* RED - 0xE23C39<br>* PURPLE - 0x212121
typestringfalsenonegeojson属性