Simple way to clear all operational layers and graphics from a map?

1522
3
Jump to solution
10-11-2018 06:56 AM
JohnRichardson
New Contributor III

I see that this type of question has been asked and answers have been attempted multiple times all over the internet, but none of them satisfy my needs.

Is there not a way to clear a mapview of everything but the basemap with one simple command?

Please and thank you!

0 Kudos
1 Solution

Accepted Solutions
BlakeTerhune
MVP Regular Contributor
3 Replies
BlakeTerhune
MVP Regular Contributor

What about Map.removeAll()

It would be helpful to mention your specific needs and what solutions you've already tried.

JohnRichardson
New Contributor III

Blake

My apologies .... I meant to ask as to a way to render all feature and queryresult layers invisible, not actually remove them from the map.

My fault, and thanks!

0 Kudos
BlakeTerhune
MVP Regular Contributor

Maybe iterate over the Map.allLayers and set layer.visible = false