Skip to content

Instantly share code, notes, and snippets.

@astojilj
Last active August 17, 2023 04:49
Show Gist options
  • Save astojilj/c241ff0d0aa7e437cacd70cc09485f47 to your computer and use it in GitHub Desktop.
Save astojilj/c241ff0d0aa7e437cacd70cc09485f47 to your computer and use it in GitHub Desktop.
Hiding trees layer from style programatically
map.on('style.load', function() {
const treesLayerId = map.style._order.find((id) => map.style.getLayer(id).type === 'model' && id.startsWith("trees"));
if (treesLayerId) {
map.setLayoutProperty(treesLayerId, 'visibility', 'none');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment