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

turing on an off layers #23

Closed
idastorm opened this issue Nov 26, 2017 · 1 comment
Closed

turing on an off layers #23

idastorm opened this issue Nov 26, 2017 · 1 comment

Comments

@idastorm
Copy link
Collaborator

After struggling a little with the time slider demo (issue #20 - new post soon), upon a request from @johaahlf , I have been looking at turning on and off different place categories (defined by different IDs in the style.json file), but without success. I am hoping that @klokan or someone else can look at it and give me feedback? It is just a test for turning on and off the major settlements.

This is the key lines. The whole file is also attached.

var hideLayer = function(layerId) {
if (!STYLE_JSON) return;
var styleObj = JSON.parse(JSON.stringify(STYLE_JSON));

//accessing the style sheet with the ID places_major_settlement. Updated style version where set to visible on default (all boxes checked)

styleObj[layerId].layout.visibility = 'none';
map.setStyle(styleObj);

};

checkboxes.zip

@idastorm
Copy link
Collaborator Author

found a solution, uploading here shortly.

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

1 participant