We would like to implement a basemap opacity slider but there doesn't seem to be a method to set this property...
Tim,
This might help: Help setting opacity/transparency of Basemap
Yes there are a few ways to do this.
<Number > opacity | Optional | Initial opacity or transparency of the basemap layer. Values range from 0.0 to 1.0 where 0.0 is 100% transparent and 1.0 has no transprency. The default value is 1.0. |
BasemapLayer | API Reference | ArcGIS API for JavaScript
Do you want to use arcgis basemap or your own?
There is the setOpacity(); method.
ArcGISDynamicMapServiceLayer | API Reference | ArcGIS API for JavaScript
-Steven
Thanks for the responses so far. I should probably clarify...
We're using our own basemaps, not the ESRI ones, so we creating a new BasemapLayer object then adding it to a new Basemap object. Interestingly you can also use an esri.layers.ArcGISTiledMapServiceLayer as a value for the Basemap "layer" property so I'm not completely sure what the BasemapLayer object is for.
BasemapLayer | API Reference | ArcGIS API for JavaScript
Basemap | API Reference | ArcGIS API for JavaScript
Neither the BasemapLayer or the Basemap object appear to have an opacity property. I tried using an esri.layers.ArcGISTiledMapServiceLayer as the "layer" property of the Basemap object instead of a BasemapLayer object then setting the opacity of the esri.layers.ArcGISTiledMapServiceLayer but that doesn't work.
I know I can work round it by adding the base mapping as a normal map layer (map.addLayer) then setting the opacity of that, but it would mean we couldn't use things like the basemap gallery or basemap toggle widgets. Also, I don't know what the benefits of BasemapLayer and Basemap are. I think I read somewhere about using the levels of detail (lods) to set the number of tick points on a zoom slider but I can't find it now.
You might check out this thread. They hooked the slider up to the basemap being displayed on the map and changed it between 2. It might provide some guidance.
set basemap opacity with slider
-Steven