问题描述
晚上好,我在实时查看传单时遇到问题,更新了坐标,图标在地图上移动了,但是如果地图上属性中的值发生变化,而弹出菜单中的值不变。 例如 标记的旋转不变,速度数据不变。等。
这是我写的代码:
var map = L.map('map',{minZoom: 3,maxZoom: 18});
L.Control.measureControl().addTo(map);
mapLink = 'Esri';
wholink = 'i-cubed,USDA,USGS,AEX,GeoEye,Getmapping,Aerogrid,IGN,IGP,UPR-EGP,and the GIS User Community';
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',{
attribution: '© '+mapLink+','+wholink,maxZoom: 18,}).addTo(map);
var shipLayer = L.layerGroup();
var realtime = L.realtime(
{
url: 'http://localhost/api/xxx/',crossOrigin: true,type: 'json',},{
interval: 2 * 1000,getFeatureId: function(featureData){
return featureData.properties.idRisorsa;
},pointToLayer: function (feature,latlng) {
var track = L.icon({
iconUrl: 'https://localhost' + feature.properties.TipoRisorsa + '.png',iconSize: [30,30]
});
tracker = L.marker(latlng,{icon: track,rotationAngle: feature.properties.Angolo,title: feature.properties.NomePilota + " " + feature.properties.MarcaDrone} );
tracker.bindPopup('Id: ' + feature.properties.idRisorsa +
'
Angolo: ' + feature.properties.Angolo +
'
Nome:' + feature.properties.NomePilota +'' +
'
Marca:' + feature.properties.MarcaDrone +
'
Coordinate: ' + latlng);
tracker.addTo(shipLayer);
return tracker;
}}).addTo(map);
realtime.on('update',function() {realtime.getBounds(),{maxZoom: 18};});
map.setView([0,0],0);
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)