Select to view content in your preferred language

Possible problem with JavaScript API 3.16 AcrGISDynamicMapServiceLayer visibleLayers property[non-issue]

1024
2
Jump to solution
01-17-2017 07:01 AM
NicholasToscano1
New Contributor

The JavaScript API 3.16 AcrGISDynamicMapServiceLayer visibleLayers property does not refer to the property it is described to hold. One would suspect from this description:

That this property would hold an array of the layers in the ArcGISDynamicMapServiceLayer that are visible. So one would expect something like [0,3,5]. Representing that the layers in the service at those endpoints that are currently visible. Instead it appears to just return the amount of visible layers. THIS IS NOT HELPFUL. Here is an example of what it shows in the console(see the bottom property in the image below):

The property that closest resembles what I am looking for is "_defaultVisibleLayers", infact it shows exactly what visibleLayers is supposed to show but I am assuming it is the initial visibile layers and wouldn't change if I changed the visibility:

ALSO. LOOK AT INDEX 8.

WHAT IS "0" ?

THAT REFERS TO NOTHING TO ME. None of my layers have a unique ID of "0".

As with all things with programming, it is easy to misunderstand or accidentally overlook something in the Docs so if someone can clear this up for me in regards of me misconstruing the intended purpose of the visibleLayers property please do. 

Otherwise this is a BUG, and it has persisted since atleast 3.16 and is still present at 3.16. It is odd that this has been overlooked and it needs to be addressed and or the property needs a new description.

Thanks

Nick T

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Nick,

  Can you post the code you used to get that result returned? I do not get that result. It returns exactly what the documentation specifies an array of visible layer ids.

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Nick,

  Can you post the code you used to get that result returned? I do not get that result. It returns exactly what the documentation specifies an array of visible layer ids.

NicholasToscano1
New Contributor

Robert, turns out I didn't have the latest API the way I thought I did. Once I switched out the old one it worked fine. Thanks for your response.

0 Kudos