Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 单张标记更新_Javascript_Leaflet_Angular Leaflet Directive - Fatal编程技术网

Javascript 单张标记更新

Javascript 单张标记更新,javascript,leaflet,angular-leaflet-directive,Javascript,Leaflet,Angular Leaflet Directive,嗨,我有个关于angular 5的传单标记的问题, 标记值是动态的,我只需要绘制最后的结果。 请问我怎么做? 这里有人有同样的问题吗 var标记;markers=new L.LayerGroup().addTo(myfrugalmap);让timer=TimerObservable.create(0,10000);this.subscription=timer.subscribe(t=>{this.MyService.Localize().subscribe(result=>{this.posi

嗨,我有个关于angular 5的传单标记的问题, 标记值是动态的,我只需要绘制最后的结果。 请问我怎么做? 这里有人有同样的问题吗

var标记;markers=new L.LayerGroup().addTo(myfrugalmap);让timer=TimerObservable.create(0,10000);this.subscription=timer.subscribe(t=>{this.MyService.Localize().subscribe(result=>{this.positions=result;let xpo=this.positions.x;let ypo=this.positions.y;let mar=L.marker([xpo,ypo],{icon:greenIcon})mar.addTo(markers)});markers.clearLayers();})


结果(没有(markers.clearLayers))我在地图上有10秒钟的新位置,我需要删除旧位置

请提供更多信息和/或代码示例。让我们看看你到目前为止都做了些什么。很难用你所给的来识别问题;markers=new L.LayerGroup().addTo(myfrugalmap);让timer=TimerObservable.create(0,10000);this.subscription=timer.subscripte(t=>{this.MyService.Localize().subscripte(result=>{this.positions=result;let xpo=this.positions.x;let ypo=this.positions.y;let mar=L.marker([xpo,ypo],{icon:greenIcon})mar.addTo(markers)});markers.clearLayers();})结果(没有(markers.clearLayers)),我有10秒钟的时间在地图上找到新的位置,我需要删除旧的位置。你怎么看?@YASSIRELHOUSNI请不要在评论中发布这个,编辑你的帖子。