Select to view content in your preferred language

Error On Loading ArcGISDynamicMapServiceLayer

2882
2
Jump to solution
11-06-2015 05:55 AM
BruceGreen
New Contributor III

Can you please take a look at this demo ​and let me know why I am getting this error

Uncaught ReferenceError: ArcGISDynamicMapServiceLayer is not defined

As you can see I have registered the "esri/layers/ArcGISDynamicMapServiceLayer", but still getting the error

var map;
var layerOpacity = 0.25;
require(["esri/map",
    "esri/layers/ArcGISDynamicMapServiceLayer",
    "dojo/parser",
    "dojo/dom",
    "dojo/on",
    "dojo/ready",
    "dojo/domReady!"], function (
Map,
ArcGISDynamicMapServiceLayer,
parser,
dom,
on,
ready) {
    map = new Map("mapDiv", {
        center: [-126.687482, 54.793577],
        zoom: 5,
        basemap: "topo"
    });
});
 var appLayer    = new ArcGISDynamicMapServiceLayer("http://renewablestoolbox.biol.sfu.ca/rorapp/rest/services/RORApp/MapServer/22");
map.addLayer(appLayer);
0 Kudos
1 Solution

Accepted Solutions
thejuskambi
Regular Contributor

The require function is closed just before where you initialize the var appLayer.

you need to write code within that block

View solution in original post

2 Replies
thejuskambi
Regular Contributor

The require function is closed just before where you initialize the var appLayer.

you need to write code within that block

RobertScheitlin__GISP
MVP Emeritus

Behrouz,

   The issue is that your code has the new ArcGISDynamicMapServiceLayer outside the main code block (i.e. });)

EDIT: looks like thejus answered before I posted.