angular-ui / ui-leaflet

AngularJS directive to embed an interact with maps managed by Leaflet library
http://angular-ui.github.io/ui-leaflet
Other
315 stars 137 forks source link

geojson visibility #334

Open cyrilchapon opened 7 years ago

cyrilchapon commented 7 years ago

I use nested geojson stuff :

<leaflet
  ...
  geojson="map.geojson"
  geojson-nested="true"
  ...>
</leaflet>
    $scope.map = {
      ...
      geojson: {
        ways: _.extend({}, mapStyles.ways, {
          name:'ways',
          visible: true
        })
      },
      ...
    };

And visible toggle doesn't work.

Even worse, if I map.removeLayer(<mylayer>) (which works), when I update $scope.map.geojson.ways.data, it readds the layer to the map.


I also tried

    $scope.map = {
      ...
      geojson: {
        ways: _.extend({}, mapStyles.ways, {
          name:'ways',
          visible: false, // <--- notice this
          layerOptions: {
            visible: false // <--- and this
          },
          layerOptions: {
            visible: false // <--- and this
          }
        })
      },
      ...
    };

None worked


I didn't try non-nested geojson