v1.2.1 Layer swapper widget for David Spriggs Configurable Map Viewer
Widget designed to allow swapping of a configurable list of layers. Most obvious use case is flipping thru historical imagery. Works best for layers which should be mutually exclusive of each other. Also allows fading of the selected layer via a slider control.
New in this version:
- Added esri layerSwipe widget to allow the displayed layer to be swiped
- Added reset button to quickly hide the current layer and set the widget back to it's initial state
Configuration details below.
To configure the in your project
- Copy the LayerSwapper directory and LayerSwapper.js file into your viewer/js/gis/dijit directory
- Add the following to your CMV viewer config file
layerSwapper: {
include: true,
id: 'layerSwapper',
type: 'titlePane',
title: 'Historical Imagery',
path: 'gis/dijit/LayerSwapper',
open: true,
options: {
map: true,
layerInfos: [
{
'label': '1950', //name of layer in selector
'url': 'http://your-server.com/arcgis/rest/services/your-service/MapServer', //url to dynamic or tiled service
'type': 'tiled' //type of layer, either 'tile' or 'dynamic'
}
]
}
}
If you have many layers, it is suggested to use a config file. Simply change the 'options' parameter to point to your config file:
options: 'config/layerSwapper'