Select to view content in your preferred language

Request: Stop using webmaps in samples

992
4
Jump to solution
10-02-2013 08:06 AM
JeffPace
MVP Alum
Wasn't sure where to put this. 

The trend of using webmaps in
var mapDeferred = arcgisUtils.createMap("62702544d70648e593bc05d65180fd64", "map");


Is really frustrating as a developer. It hides so much code.

For example:
I looked at the LayerSwipe sample.  Looks cool, I wonder what the overlay layers are and how to specify them.  Open source code.

Oh.. its a webmap, cant see anything.

Oh well, can't use sample.

Is there anyway, that at least in the samples, everything can be manually defined?
0 Kudos
1 Solution

Accepted Solutions
KellyHutchins
Esri Notable Contributor
0 Kudos
4 Replies
KellyHutchins
Esri Notable Contributor
Here's some code that shows working with the LayerSwipe without a web map. The only difference in this sample is that we add the layers to the map manually - working with the LayerSwipe stays the same. Was there a particular option on the LayerSwipe widget that you were trying to get to work?

    require([
      "esri/map", 
      "esri/dijit/LayerSwipe",
      "esri/layers/ArcGISDynamicMapServiceLayer",
      "esri/arcgis/utils",
      "dojo/_base/array",
      "dojo/domReady!"
    ], function(
      Map, LayerSwipe, ArcGISDynamicMapServiceLayer, arcgisUtils, array 
    )  {

      map = new Map("map", {
        basemap:"gray",
        center: [-96.5, 38.3],
        zoom: 6
      });
      
     var cities = new ArcGISDynamicMapServiceLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer"); 
     cities.setVisibleLayers([0]);
     var Hurricanes = new ArcGISDynamicMapServiceLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Hurricanes/MapServer");
     Hurricanes._div = map.root;
     cities._div = map.root;

     map.addLayers([Hurricanes, cities]);

    var swipeWidget = new LayerSwipe({
      type: "vertical",  //Try switching to "scope" or "horizontal"
      map: map,
      layers: [Hurricanes]
    }, "swipeDiv");

    swipeWidget.startup();  

    });


0 Kudos
JeffPace
MVP Alum
http://forums.arcgis.com/threads/93857-LayerSwipe-and-Basemaps

Trying to see if i can swipe basemaps underneath operational layers
0 Kudos
KellyHutchins
Esri Notable Contributor
0 Kudos
JeffPace
MVP Alum
thanks Kelly!
0 Kudos