AnsweredAssumed Answered

Dynamic layer info minScale/maxScale bug in ArcGIS JavaScript API 3.0?

Question asked by qwong on Jul 4, 2012
Latest reply on Oct 3, 2012 by DSwingley-esristaff
Hi,

  I think I found a bug in ArcGIS JavaScript API 3.0 when using the dynamic layer info's minScale & maxScale properties.  Here are the steps:

  1) Create a new esri.layers.ArcGISDynamicMapServiceLayer (dynamicMapService)
  2) Create a new esri.layers.DynamicLayerInfo (dynamicLayerInfo)
  3) Set dynamicLayerInfo.minScale to something non-zero
  4) Set dynamicLayerInfo.maxScale to something non-zero
  5) Add dynamicLayerInfo to a new array (dynamicLayerInfoArray)
  6) Use dynamicMapService.setDynamicLayerInfos(dynamicLayerInfoArray) to set the map service's dynamic layer infos (you may also have to set the LayerDrawingOptions).
  7) Now, run your app and zoom in/out beyond the minScale/maxScale you chose

  Pow!  You get the following response:

  {"error":{"code":400,"message":"Missing 'source' in dynamic layer definition for 'id': -1.","details":[]}}

  If you examine the HTTP request sent to the server, it will look something like this:

  http://yourserver.com:6080/arcgis/rest/services/YourMapService/MapServer/export? ... dynamicLayers=[{}] ...

  I think it's because of those curly braces because if you get rid of them, it works just fine (although it should probably just omit the dynamicLayers parameter altogether).  I think in the Silverlight API, it simply refrains from sending the HTTP request when you zoom beyond the specified minScale/maxScale.

  Is anyone else experiencing this bug?  I don't think there's much I can do about it but if anyone has any ideas, I would very much appreciate it.  :)

Cheers!

Outcomes