Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to set active base layer ? #384

Closed
ud09 opened this issue Jun 2, 2014 · 5 comments
Closed

Is there a way to set active base layer ? #384

ud09 opened this issue Jun 2, 2014 · 5 comments

Comments

@ud09
Copy link

ud09 commented Jun 2, 2014

Hi,
I'm using the layers attribute for my fixed baselayers. I want to store and load the user's base layer selection in the localstorage so I need to set the base layer at start up.
With introducing an eg. activeLayer option and making a small change in the angular-leaflet code I could do it. Or I tried to use setting top = true for the active layer at start up, but that also ruins the order of the options in the layer control UI, making the active layer on top. ( I don't want this. ) Anyway maybe there is a simpler way to do this without changing the code. That's what I want to know.

Thanks.

@muenchdo
Copy link

muenchdo commented Jun 3, 2014

+1

@jpoehnelt
Copy link
Contributor

$scope.changeBaseLayer = function (key) {
        leafletData.getMap().then(function (map) {
            leafletData.getLayers().then(function (layers) {
                _.each(layers.baselayers, function (layer) {
                    map.removeLayer(layer);
                });
                map.addLayer(layers.baselayers[key]);
            });
        });
    };

@jpoehnelt
Copy link
Contributor

and for overlays

<div class="checkbox" ng-repeat="(key, layer) in layers.overlays">
     <label>
         <input type="checkbox" 
                    ng-model="layer.visible" 
                    ng-value="true"
                    id="overlayCheckbox-{{ $index }}">
                        {{ layer.name }}
     </label>
</div>

@nmccready
Copy link
Contributor

This issue was moved to angular-ui/ui-leaflet#22

@nmccready nmccready reopened this Oct 29, 2015
@tombatossals
Copy link
Owner

I'm going to rework&redesign angular-leaflet-directive to be compatible with Leaflet v1.0. It will mantain almost all its functionality, and will be compatible with the current features of the directive, but I must start from a fresh point, so I'm going to close this issue. If you think it must be worked with the new version, please reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants