Not Able to Add a RasterLayer to Map

2990
6
Jump to solution
10-28-2015 02:47 PM
BruceGreen
New Contributor III

Can you please take a look at This Demo​ and let me know why I am not able to add the Raster Layer  Layer: fishing_effort.tif (ID: 53) into the Map?

var map;
require([
    "esri/map",
    "esri/layers/ArcGISDynamicMapServiceLayer",
    "dojo/ready",
    "dojo/parser",
    "dijit/layout/BorderContainer",
    "dijit/layout/ContentPane"],
function (
Map, ArcGISDynamicMapServiceLayer,
ready, parser,
BorderContainer, ContentPane) {
    ready(function () {
        parser.parse();
        map = new Map("cpCenter", {
            basemap: "topo",
            center: [-9.113077, 0.759423],
            zoom: 2
        });
        var layer = new ArcGISDynamicMapServiceLayer("http://renewablestoolbox.biol.sfu.ca/rorapp/rest/services/RORApp/MapServer/53")
        map.addLayers([layer]);
    });
});

as you can see from the console I am getting 400 (Bad Request) error message but the layer is for sure at This Url

Thanks

0 Kudos
1 Solution

Accepted Solutions
RickeyFight
MVP Regular Contributor

Okay here you go

    var layer = new ArcGISDynamicMapServiceLayer("http://renewablestoolbox.biol.sfu.ca/rorapp/rest/services/RORApp/MapServer")       
     layer.setVisibleLayers([53]);


     map.addLayers([layer]);  

View solution in original post

0 Kudos
6 Replies
RickeyFight
MVP Regular Contributor
0 Kudos
BruceGreen
New Contributor III

Thanks Rickey,

I actually used same example with different Mapserver of the post which you linked but I am not getting what exactly means when they say :  For Dynamic Map Service Layers, you do not want to specify the index of the layer in the URL.  ?!

0 Kudos
RickeyFight
MVP Regular Contributor

You want to remove the /53 at the end of your service.

RORApp (MapServer)

0 Kudos
BruceGreen
New Contributor III

in That case how can I reference to fishing_effort.tif (ID: 53)? I mean the RORApp (MapServer) is URL of all Layers but I need to only display fishing_effort.tif (ID: 53)!

0 Kudos
RickeyFight
MVP Regular Contributor

One simple solution is to republish.

I think there is another one though I will look into it.

0 Kudos
RickeyFight
MVP Regular Contributor

Okay here you go

    var layer = new ArcGISDynamicMapServiceLayer("http://renewablestoolbox.biol.sfu.ca/rorapp/rest/services/RORApp/MapServer")       
     layer.setVisibleLayers([53]);


     map.addLayers([layer]);  
0 Kudos