How would you code the javascript to initialize a map with 4 layers if you want 2 layers to be initially visible when the map loads, and 2 layers to be hidden, and you want the ability to toggle the layers on and off in any combination using checkboxes. Would prefer the check boxes to be in a dojo accordion panel, but would settle for them being across the top if that is easier.
Solved! Go to Solution.
In my app I put it right after declaring my street layer.
var street = new FeatureLayer( | |
"http://gis.brevardcounty.us/gissrv/rest/services/Base_Map/General_WKID2881/MapServer/0", { | |
mode: FeatureLayer.MODE_ONDEMAND, | |
infoTemplate:null, | |
outFields: ["*"] | |
}); | |
street.setVisibility(false); |
Check out this example.
If you don't want to show a layer from the start use the following code (this will also un-check your layers).
street.setVisibility(false); //replace street with the layer name you want unchecked
Thanks Tim. Where would you use or place the setVisibility command?
In my app I put it right after declaring my street layer.
var street = new FeatureLayer( | |
"http://gis.brevardcounty.us/gissrv/rest/services/Base_Map/General_WKID2881/MapServer/0", { | |
mode: FeatureLayer.MODE_ONDEMAND, | |
infoTemplate:null, | |
outFields: ["*"] | |
}); | |
street.setVisibility(false); |
Tim,
Just what the doctor ordered. Many thanks.@
You should mark the question as answered. This will help others as they search for solutions to similar questions. Also, you should add a javascript tag to make it more searchable.
Tim,
Since you've been so helpful, I wonder if you could tell me how to quickly, simply, and easily increase the outline symbol width from the default value of 1px to 2px for color ramp symbols. I know I could regenerate the feature layer form ArcMap, but I hate to do that just to experiment with line widths.
I don't know how to do either or I would
This is a screenshot from a thread that I started. Do you have the Update Tags section in your original post and do you see the "Correct Answer" link in the subsequent posts?
OK. Got it. Thanks.