Select to view content in your preferred language

trying to add map service layer

810
3
Jump to solution
05-29-2014 06:57 AM
jaykapalczynski
Honored Contributor
Trying to add map service layer and not working...thoughts?

Syntax?  Maybe because I am using FeatureLayer?  Using Server 10.1

Note:  Changed the Rest End point URL for this example

 // Warbler 1  var flWarbler1 = new ArcGISDynamicMapServiceLayer("https://fwisweb1.gov/arcgis/rest/services/Warbler_Map/Warbler_Map_Readonly/MapServer/0", {          mode: FeatureLayer.MODE_ONDEMAND,          outFields: ['*']     });  // Warbler 2  var flWarbler2 = new ArcGISDynamicMapServiceLayer("https://fwisweb1.gov/arcgis/rest/services/Warbler_Map/Warbler_Map_Readonly/MapServer/1", {          mode: FeatureLayer.MODE_ONDEMAND,          outFields: ['*']     });  app.map.addLayer(flWarbler0);  app.map.addLayer(flWarbler1);
0 Kudos
1 Solution

Accepted Solutions
TimWitt
Deactivated User
Jay,

we would need to see the whole code. But from what I can see here, you need to use the var names in your add expression.

app.map.addLayer(flWarbler2);  app.map.addLayer(flWarbler1);


That might fix it, but again I would need to see all of the code.

Tim

View solution in original post

0 Kudos
3 Replies
TimWitt
Deactivated User
Jay,

we would need to see the whole code. But from what I can see here, you need to use the var names in your add expression.

app.map.addLayer(flWarbler2);  app.map.addLayer(flWarbler1);


That might fix it, but again I would need to see all of the code.

Tim
0 Kudos
KenBuja
MVP Esteemed Contributor
Your syntax doesn't make sense if you're trying to add these as FeatureLayers. Unless the argument ArcGISDynamicMapServiceLayer is mapped to "esri/layers/FeatureLayer" in your require statement, shouldn't it be
var flWarbler1 = new FeatureLayer("https://fwisweb1.gov/arcgis/rest/services/Warbler_Map/Warbler_Map_Readonly/MapServer/0", {
         mode: FeatureLayer.MODE_ONDEMAND,
         outFields: ['*']
    });
0 Kudos
jaykapalczynski
Honored Contributor
Tim Witt & Ken Buja
Thanks....it was a mixture of issues...I had the code below to start with but as Tim pointed out the addLayer was not pointing to the correct Var....

GOOD TO GO.....appreciated thanks

 // Warbler 0
 var flWarbler0 = new FeatureLayer("https://fwisweb1.gov/arcgis/rest/services/Warbler_Map/Warbler_Map/MapServer/0", {
         mode: FeatureLayer.MODE_ONDEMAND,
         outFields: ['*']
    });
 // Warbler 1
 var flWarbler1 = new FeatureLayer("https://fwisweb1.gov/arcgis/rest/services/Warbler_Map/Warbler_Map/MapServer/1", {
         mode: FeatureLayer.MODE_ONDEMAND,
         outFields: ['*']
    });
 app.map.addLayer(flWarbler0);
 app.map.addLayer(flWarbler1);
0 Kudos