Removing leaflet layers and L.marker method

前端 未结 3 715
生来不讨喜
生来不讨喜 2021-02-01 22:23

I was wondering if anyone knows how or if you can actually remove a layer of points after adding them using this convention:

var pointsLayer, someFeatures = [{
          


        
3条回答
  •  伪装坚强ぢ
    2021-02-01 22:46

    You can go over all layers directly in object 'map'.

    for ( key in map['_layers'] ){
        if(typeof map['_layers'][key]['feature'] !== 'undefined') {
            var l = map['_layers'][key];
            if( l['feature']['properties']['name'] === 'Company A' ) l.removeFrom(map);}}
    

提交回复
热议问题