Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

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);
share|improve this answer
    
i swear I tried this and it was not working before but now it is!! Thanks –  Sam007 Nov 2 '12 at 5:43
    
Are the url which you are using for feature layer and ArcGISDynamicMapServiceLayer are the same...??? –  Gunner Nov 2 '12 at 6:53
    
Almost @Gunner. Except for the last mapservice/1 for featureLayer everything else is same for DynamicLayer –  Sam007 Nov 4 '12 at 2:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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