AnsweredAssumed Answered

OverviewMap and Scalebar with dynamicMapServiceLayer

Question asked by geonetadmin on Sep 23, 2013
Latest reply on Sep 23, 2013 by geonetadmin
Original User:
Original Date: 2013-09-23T12:19:12-0600

I've recently started with the developement of a small webmap using Java script.
For now I just concentrate on some basic features like adding a scalebar and an overview map.
I've search for some examples for scalebar and overviewmap and put them together:

    <link rel="stylesheet" href="">
    <link rel="stylesheet" href="">
      html, body { height: 100%; width: 100%; margin: 0; padding: 0; }

    <script src=""></script>
      var map;

        "esri/map", "esri/dijit/Scalebar", "esri/dijit/OverviewMap",

        "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!",
      ], function(
        Map, Scalebar, OverviewMap,
      ) {

        map = new Map("map", {
          basemap: "topo",
          center: [-116.093, 34.218],
          zoom: 7

        var scalebar = new Scalebar({
          map: map,
          // "dual" displays both miles and kilmometers
          // "english" is the default, which displays miles
          // use "metric" for kilometers
          scalebarUnit: "dual"
        var overviewMapDijit = new OverviewMap({
          map: map,
          visible: true

Now I want to replace the basemap with a dynamicMapServicelayer but it doesn't work. The code for using a dynamicMapService is the following...I've tried out so many combination, but with no success.

    <script src=""></script>

      var map;

      function init() {
        map = new esri.Map("mapDiv", {
        //  sliderOrientation: "horizontal"

        var imageParameters = new esri.layers.ImageParameters();
        imageParameters.format = "jpeg";  //set the image type to PNG24, note default is PNG8.

        //Takes a URL to a non cached map service.
        var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("", {


It would be really nice, if somebody would help me. In addition I have another question: For which purpose I need the "function init()" and "dojo.ready(init);"? I've read the documentation, but this didn't help me.
Thanks in advance,