添加POI图层
在场景中添加POI图层。
代码示例
let data = {
"type": "FeatureCollection",
"name": "geo_samp",
"crs": {
"type": "name",
"properties": {"name": "urn:ogc:def:crs:OGC:1.3:CRS84"}
},
"features": [
{
"type": "Feature",
"properties": {
"id": "location1",
"name": "东方之门",
"desc": "较拥挤",
"height": 5.177277,
"detailUrl": "http://xxx.xxx.xx.xxx/SIPSD/poi/location1.html",
"heading": 140,
"pitch": -33,
"distance": 223.5,
"time": 3
},
"geometry": {
"type": "Point",
"coordinates": [120.675462, 31.318861]
}
},
{
"type": "Feature",
"properties": {
"id": "location2",
"name": "苏州中心商场",
"desc": "较拥挤",
"height": 53.930321,
"detailUrl": "http://xxx.xxx.xx.xxx/SIPSD/poi/location2.html",
"heading": -157,
"pitch": -21,
"distance": 123.5,
"time": 3
},
"geometry": {
"type": "Point",
"coordinates": [120.673454, 31.31842]
}
},
{
"type": "Feature",
"properties": {
"id": "location3",
"name": "中茵皇冠假日酒店",
"desc": "舒适",
"height": 37.237129,
"detailUrl": "http://xxx.xxx.xx.xxx/SIPSD/poi/location3.html",
"heading": -148,
"pitch": -29,
"distance": 623.5,
"time": 3
},
"geometry": {
"type": "Point",
"coordinates": [120.678711, 31.324223]
}
},
]
}
let options = {
"mainStyle": {
"property": "name",
"style": [
{
"value": "东方之门",
"color": "#F03B71",
"iconImage": "http://xxx.xxx.xx.xxx/SIPSD/icon/jingqu.png",
"iconWidth":150,
"iconHeight":50,
"layout": {
"width": 578,
"height": 214
}
}, {
"value": "苏州中心商场",
"color": "#048A00",
"iconImage": "http://xxx.xxx.xx.xxx/SIPSD/icon/gouwu.png",
"iconWidth":120,
"iconHeight":120,
"layout": {
"width": 440,
"height": 150
}
}, {
"value": "中茵皇冠假日酒店",
"color": "#ff9900",
"iconImage": "http://xxx.xxx.xx.xxx/SIPSD/icon/gouwu.png",
"layout": {
"width": 440,
"height": 150
}
}
]
},
"tagStyle": {
"property": "desc",
"style": [
{
value: "舒适",
color: "#66cc66"
}, {
value: "较拥挤",
color: "#ff9966"
}, {
value: "拥挤",
color: "#ff6666"
}
]
}
}
mapmostUE.addPOIs("layer1", data, options)
效果
