Exercise: Creating a Hybrid Basemap The available basemaps for the Flex Viewer should be defined inside the tag. Each basemap is defined with a tag which contains attributes including the ‘label’, ‘type’, ‘visibility’, and ‘url’ among others.
Only one basemap layer can be active at a time. However, as you’ll see in this exercise, you can combine layers to create ‘hybrid’ basemaps. This is accomplished by defining the same value for each layer for the ‘label’ attribute along with an ‘alpha’ value for one of the layers. The Map Switcher widget contains a button for each defined within the tag and users can switch the active basemap using this widget. Step 1: Open the Configuration File
Open config.xml in your favorite text editor.
Step 2: Alter Tags to Support Hybrid Basemap
Make the following changes to your layer tags.
Notice that the ‘label’ attribute for both layers is set to ‘Hybrid’. Both ‘visible’ properties are set to true. Finally, we’ve set the ‘alpha’ attribute on the Imagery layer so that the Streets layer above can be viewed at the same time. Save the config.xml file and open the Flex Viewer in a browser. The street layer and imagery layer have now been combined into a ‘hybrid’ layer. Also notice that a ‘Hybrid’ button has been added to the Map Switcher.