Select to view content in your preferred language

Multiple Base Maps for Streets Aerial Topo

756
2
08-04-2010 01:08 PM
MatthewLawton
Deactivated User
This is an issue I have been dealing with in the Flex Sample Viewer for a while and I see it is still an issue in 2.0. How can I add additional Base Maps to my app without generating multiple buttons on my toolbars? For example, I have my own tiled base map (or street map) that is cached with the Google/Bing scheme. I would like to also have the ESRI World Street Map as a backdrop to my base map for areas outside of that base map. Likewise, I have my own aerial photo and topo cached services, but would like to have the ESRI World Imagery and USA Topo services as backdrops to each of those respectively. If I just add these services to the config.xml like this:

<mapservice label="Streets" type="tiled" visible="true"  alpha="1"
                        url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
            <mapservice label="Streets" type="tiled" visible="true"  alpha="1"
                        url="http://<server>/ArcGIS/rest/services/BaseLayersWebMercator/MapServer"/>


...then I get two "Streets" buttons. I just want one "Streets" button that will turn both of these services on at the same time with my service on top. Likewise if I toggle to the "Aerial" and "Topo" buttons. I'm assuming I can't do this by simply modifying the config.xml. How might I go about this?
Tags (2)
0 Kudos
2 Replies
ChenJuequan
Deactivated User
Just create your own MapSwitcherWidget will meet your demand.
0 Kudos
MatthewLawton
Deactivated User
I'm assuming the part I would alter in the MapSwitcherWidget.mxml is somewhere in here:

// base maps
                mapList = new ArrayCollection(configData.basemaps);
                if (mapList.length <= 1)
                {
                    this.currentState = "noBasemapsBB";
                }
                else
                {
                    setTbbSelectedIndex();
                }

                toc.map = map;
                toc.isMapServiceOnly = false; //gotta get this from the config file
                toc.excludeLayers = getExcludeLayers();
                toc.excludeGraphicsLayers = true;

                hideTimer.addEventListener(TimerEvent.TIMER_COMPLETE, hideTimer_timerCompleteHandler, false, 0, true);
    callLater(expandTOC);


Can you provide a little more guidance please? I'm curious, what does the getExcludeLayers function do? What is the property toc.isMapServiceOnly and why is it false? I tried looking these up in the API reference but I couldn't find them.
0 Kudos