获取地图元素
获取元素列表
PILOT在首次上线后,会发送http请求去获取地图元素列表,服务端需要把共享的地图元素列表发给PILOT。同时,当接收到websocket指令进行图层刷新的时候,也是需要调用该接口进行请求地图元素列表。
注意:列表里需要有App共享图层,否则后继元素修改将无法同步到服务器。
GET /map/api/v1/workspaces/{workspace_id}/element-groups
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
group_id | query | string | false | 元素组id(同一个元素组下可以包含多个地图元素,相当于给地图元素进行分组。在发起请求时,如果不带group_id参数,则服务端会把所有地图元素全部返回,如果指定了group_id,则只会返回指定的元素组内的元素集合) |
is_distributed | query | boolean | false | 元素组分发状态(默认为true) |
workspace_id | path | string | true | 工作空间id |
x-auth-token | header | string | true | 访问令牌 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | map.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
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
code | integer | false | none | 错误码 |
data | [map.ElementGroupOutput] | false | none | none |
message | string | false | none | 错误描述 |
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
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
create_time | integer | false | none | 元素组创建时间(毫秒) |
elements | [map.ElementItem] | false | none | 元素集合 |
id | string | false | none | 元素组id |
is_lock | boolean | false | none | 是否锁定 (若锁定,则该元素组下的元素不可进行删除和修改) |
name | string | false | none | 元素组名称 |
type | integer | false | none | 元素组类型<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
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
create_time | integer | false | none | 元素创建时间(毫秒) |
id | string | false | none | 元素id |
name | string | false | none | 元素名称 |
resource | map.ResourceItem | false | none | 资源对象 |
update_time | integer | false | none | 元素更新时间(毫秒) |
map.ResourceItem
{
"content": {
"geometry": {
"coordinates": [
null
],
"type": "text"
},
"properties": {
"clampToGround": true,
"color": "string"
},
"type": "text"
},
"type": 0
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
content | map.Content | false | none | 资源内容对象 |
type | integer | false | none | 资源类型<br> * 0 - pin点<br> * 1 - 线<br> * 2 - 面 |
map.Content
{
"geometry": {
"coordinates": [
null
],
"type": "text"
},
"properties": {
"clampToGround": true,
"color": "string"
},
"type": "text"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
geometry | object | false | none | geojson属性 |
» coordinates | [any] | false | none | geojson属性 |
» type | string | false | none | geojson属性 |
properties | object | false | none | geojson属性 |
» clampToGround | boolean | false | none | 是否贴地 |
» color | string | false | none | 支持的元素颜色<br> * BLUE:0x2D8CF0<br> * GREEN - 0x19BE6B<br><br> * YELLOW - 0xFFBB00<br><br> * ORANGE - 0xB620E0<br><br> * RED - 0xE23C39<br> * PURPLE - 0x212121 |
type | string | false | none | geojson属性 |