Select to view content in your preferred language

Creating the map

924
1
Jump to solution
03-19-2014 12:09 PM
MattMcLees
Emerging Contributor
I've inherited a map that is set up in this manner.

      dojo.require("dijit.layout.BorderContainer");
      dojo.require("dijit.layout.ContentPane");
      dojo.require("esri.map");
      dojo.require("dijit.layout.TabContainer");
                       
      var map;
    
function init() {
        map = new esri.Map("map", {
logo: false
        });

        var basemap = new esri.layers.ArcGISTiledMapServiceLayer("Layer url goes here");
        var dynamicLayer = new esri.layers.ArcGISDynamicMapServiceLayer("Layer url goes here");

        dojo.connect(map, "onLayersAddResult", function(results) {
        });
        map.addLayer(basemap);
        map.addLayers([dynamicLayer]);
     }
     dojo.ready(init);

Is it possible to add home and basemap toggle buttons to the above? How can I do that? What is the difference between the above and the api sample code? e.g.

var map;
  require(["esri/map", "dojo/domReady!"], function(Map) {
    map = new Map("mapDiv", {
      center: [-56.049, 38.485],
      zoom: 3,
      basemap: "streets"
    });
  });
0 Kudos
1 Solution

Accepted Solutions
TimWitt
Deactivated User
Matt,

the map you have inherited is in Legacy style and the example you have posted is in AMD style. ESRI and Dojo is moving towards AMD and away from legacy. This might help you with translating.

For homebutton use this and for basemap toggle use this. Both links are in legacy style.

Hope this helps!

Tim

View solution in original post

0 Kudos
1 Reply
TimWitt
Deactivated User
Matt,

the map you have inherited is in Legacy style and the example you have posted is in AMD style. ESRI and Dojo is moving towards AMD and away from legacy. This might help you with translating.

For homebutton use this and for basemap toggle use this. Both links are in legacy style.

Hope this helps!

Tim
0 Kudos