给要素添加标签
要素信息如下:
需要添加的标签是marker activity group这一列的信息。
效果图如下:
可以看到是绿色的文字,绿色并且透明的点标记
1.创建底图
"esri/webmap"
var map = new webmap({
portalitem:{id:"372b7caa8fe340b0a6300df93ef18a7e"}
});
2.获取要素图层
"esri/layers/featurelayer"
var featurelayer = new featurelayer({
portalitem:{id:"6012738cd1c74582a5f98ea30ae9876f"},
renderer:{
type:"simple",
symbol:{
type:"simple-marker",
color:rgba(0,100,0,0.6),
size:3,
outline:{
color:[0,0,0,0.1],
width:0.5
}
},
labelinginfo:[labelclass]
}
});
var labelclass = {
symbol:{
type:"text",
color:"green",
halocolor:"black", //光环的颜色
font:{
family:"playfair-display",
size:12,
weight:"bold"
}
},
labelplacement:"above-center",
labelexpressioninfo:{
expression:"$feature.marker_activity_group"
}
}
3.显示底图和图层信息
"esri/views/mapview"
var view = new mapview({
map:map,
container:"viewdiv",
center:[-116.9250, 34.2501],
zoom:14
});
4.另外新添了一个搜索框
"esri/widgets/search"
view.ui.add(new search({view:view}),"top-right");
上一篇: 红魔游戏手机6S Pro官方预热:搭载能上天的散热黑科技
下一篇: ajax知识点