WebGIS开发智慧机场项目实战(3)

1.点图层

image.png


2、代码实现

const data = {
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        height: 40,
        name: "汉口"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [114.349938, 30.584176]
      }
    },
    {
      "type": "Feature",
      "properties": {
        height: 70,
        name: "武昌"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [114.320813, 30.542043]
      }
    },
    {
      "type": "Feature",
      "properties": {
        height: 90,
        name: "汉阳"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [114.383724, 30.551073]
      }
    }
  ]
};

scene.on("loaded", () => {
  const pointLayer = new L7.PointLayer({
    //可以设置图层的堆叠顺序
    zIndex: 6
  })
    .source(data)
    .color('#006CFF')
    .shape('circle')
    .size(30)
    .style({
      opacity: 0.8,
      strokeWidth: 3
    })
    .active(true)
    .scene.addLayer(pointLayer);
});


2-1、size 获取设置为动态值

image.png

.size("height", h => { console.log(h) return h / 3 
}) 


2-2、点击图层Popup弹窗

image.png

pointLayer.on("click",evt=>{ 
let {name} = evt.feature.properties; const popup = new L7.Popup({ 
lngLat:evt.lngLat, 
html:`<p>${name}</p>` 
}) 
scene.addPopup(popup) 
}) 


3.散点动画

1、效果

image.png

2、代码

const pointLayer = new L7.PointLayer({ //可以设置图层的堆叠顺序 
zIndex: 6 
}) 
.source(data) 
.color('#006CFF') 
.shape('circle') 
.size("height", h => { 
return h 
}) 
.active(true) 
.animate(true) 
scene.addLayer(pointLayer); 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值