Change Dynamic layer visibility

2563
2
07-11-2012 01:33 PM
DanaReed
New Contributor
hi,

Suppose I have a dynamic map service with multiple layers, is there a way to control which layer to show/hide from javascript api? For example,

var dLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://localhost:6080/arcgis/rest/services/map1/MapServer");

And MapServer dLayer has 3 layers:
Layers:

  • School (0)

  • CityHall (1)

  • River (2)

And I want the web client to control which layer to show. Is this possible with javascript API?
0 Kudos
2 Replies
JianHuang
Occasional Contributor III
0 Kudos
DanaReed
New Contributor
Thanks. It worked. Don't know why it didn't work for me the first time.

Wei,

Please try this:
http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/arcgisdynamicmapservic...
0 Kudos