2

I am right now adding individual layers using FeatureLayer but it takes quite some time to load as the map is for US Counties (3076 count). I tried to load it using ArcGISDynamicMapServiceLayer but I was not successful. It seems that ArcGISDynamicMapServiceLayer can load mapserver but not the layers in the mapserver.

I used the following code but it did not work.

var ftrLyr = new esri.layers.ArcGISDynamicMapServiceLayer(url, {
    visibleLayers: [1]
});

Is it not possible to load layers in a mapserver using DynamicMapService?

1 Answer 1

3

The parameter visibleLayers isn't an option used in the construction of an ArcGISDynamicMapServiceLayer. What you can do is call the setVisibleLayers method on the layer before adding it to the map. Here's an example using your example:

var ftrLyr = new esri.layers.ArcGISDynamicMapServiceLayer(url);

ftrLyr.setVisibleLayers([1]);

map.addLayer(ftrLyr);
3
  • i swear I tried this and it was not working before but now it is!! Thanks
    – Sam007
    Commented Nov 2, 2012 at 5:43
  • Are the url which you are using for feature layer and ArcGISDynamicMapServiceLayer are the same...???
    – Gunner
    Commented Nov 2, 2012 at 6:53
  • Almost @Gunner. Except for the last mapservice/1 for featureLayer everything else is same for DynamicLayer
    – Sam007
    Commented Nov 4, 2012 at 2:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.