Leaflet自动站点设置

	  this.markersAdd = L.markerClusterGroup();
      // console.log(this.addressPoint1w, this.addressPoint1w.length);
      for (var i = 0; i < this.addressPoint1w.length; i++) {
        var a = this.addressPoint1w[i];
        // ID
        let staId = a.boat_ID;
        this.stationId = staId;
        // 温度
        let staTemp = a.tem + '°C';
        this.stationTemp = staTemp;
        // 风向
        let staDire = a.win_D + '°';
        this.stationDire = staDire;
        // 风速
        let staAnem = a.win_S + 'm/s';
        this.stationAnem = staAnem;
        // 风力
        let staPowe = a.winf;
        this.stationPowe = staPowe;
        // 时间
        let staTime = a.datetime;
        this.stationTime = staTime.replace(/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/g, '$1-$2-$3 $4:$5:$6');
        var title =
          "
" + "
" + "ID:" + this.stationId + "
" + "
" + "温度:" + this.stationTemp + "
" + "
" + "风向:" + this.stationDire + "
" + "
" + "风速:" + this.stationAnem + "
" + "
" + "风力:" + this.stationPowe + "
" + "
" + "资料时间:" + this.stationTime + "
" + // "
" + // "气压:" + // this.stationPres + // "
" + // "
" + // "湿度:" + // this.stationHumi + // "
" + // "
" + // "能见度:" + // this.stationVisi + // "
" + "
" + "更多" + "
" + "
"; var markerAddr = L.marker(L.latLng(a.lat, a.lon), { title: title, icon: this.greenIcon }); markerAddr.bindPopup(title); this.markersAdd.addLayer(markerAddr); // this.staMap.addLayer(markersAdd); this.stamore.push("stamore" + i); // this.staTit.push("staTit" + i); this.stamores = "." + this.stamore[i]; $(document).on("click", _this.stamores, function() { // var staTit = $(this).siblings(); // 当前元素所有的兄弟节点 _this.stationId = staId; _this.portBuoyMoreBtn(); // _this.staTitHtml = "ID:" + _this.stationId; _this.stationTemp = staTemp; _this.stationDire = staDire; _this.stationAnem = staAnem; _this.stationPowe = staPowe; _this.stationTime = staTime.replace(/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/g, '$1-$2-$3 $4:$5:$6'); _this.stationMore(); }); } this.staMap.addLayer(this.markersAdd);

你可能感兴趣的:(Leaflet自动站点设置)