Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 3 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);


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

Your Answer


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.