ArcGIS Online API Javascript - toggle layer visibility

875
2
03-30-2014 10:05 PM
MonaBartling
New Contributor
Hey everyone,

I have a webmap on ArcGIS Online (I dont use ArcGIS Server) and would like to create an application with js. This, I already was able to do. However, I am wondering how it is possible to toggle the layer visibility. I read the tutorial how to toggle layers provided by ArcGIS. Anyway, it uses the expression "ArcGISDynamicMapServiceLayer.setVisibleLayers()". But I cant use this expression when I just uploaded a map to ArcGIS Online and I use this webmap in js right? I dont have a direkt URL to the layers of the webmap. Havent found a solution how to toggle the layer visibility. Would be glad to get some hints.
0 Kudos
2 Replies
ManojrajTeli
Occasional Contributor II
Hi,

This might help you
Toggle Layer Visibility
This forum post might help you
Toggle Visibility


Thanks,
Manojraj
0 Kudos
MonaBartling
New Contributor
Thanks Manojraj for the reply.

But the example also works with "ArcGISDynamicMapServiceLayer", which means that I need a direct link to the layer I want to toggle. But how is that posible if I have the layers in my webmap and only a link to that map and not to the layer?
0 Kudos