Make ArcGISDynamicMapServiceLayer Invisible,Low Opacity or Transparent at Scale Level

569
1
08-09-2012 10:25 AM
JoshuaWallin
New Contributor
I have a  ArcGISDynamicMapServiceLayer that I only want to make it visible when you get higher than scale 4 in the map as defined by my ArcGISTiledMapServiceLayer and I can't find a good way to do this.  I have it so that the layers aren't visible in mxd at these scales but I had to use a nontransparent ImageFormat to get the detail I wanted in the layer.  I think I'm almost there, code excerpts are below. 

dojo.connect(map, "onExtentChange", LayerVisible)


function LayerVisible(extent, delta, outLevelChange, outLod) {        
if(outLod.level > 4) {                 }}

I want to use something like MyLayer.setOpacity(0) inside the brackets but I can't seem to pass the MyLayer properly to a function or access it from within the function without passing it.

Can anyone help me or tell me how else to make an entire dynamicservicelayer not show at a certain scale.
0 Kudos
1 Reply
JohnGravois
Frequent Contributor
Not sure if you're trying to write something more modular, but you could always look in REST at the scale that corresponds with a particular level for your tiled service and then use it to setMaxScale() on the entire DynamicMapService layer.

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/arcgisdynamicmapservicelayer.htm#setMa...
0 Kudos