Hi -
I've seen many posts about scale-based symbology using Arcade (e.g. change the point size). I was wondering if it was possible to control a layer's transparency via Arcade so that a layer becomes more transparent as a user zooms in on a map.
Currently, I have two copies of the same layer in my map - one is opaque and the other is semi-transparent. As the user zooms in on the map, the opaque version disappears and is 'replaced' by the semi-transparent version.
Ideally, I'd like to use Arcade to change the transparency of a single layer as the user zooms in. This would help immensely as I am using my map in Experience Builder and the filter widget can only be applied to one layer.
Any advice would be appreciated,
Solved! Go to Solution.
I wanted to post my solution to this in case it is useful to others. I reached out to our local Esri contacts and was informed that while this is possible using Arcade, there is a bug in the map viewer which prevents it from working properly. Below is a workaround which I tested and was successfully able to implement in my map:
I tested this and it worked. I would recommend testing in a copy of your web map and copying/pasting default JSON into Notepad just in case.
I wanted to post my solution to this in case it is useful to others. I reached out to our local Esri contacts and was informed that while this is possible using Arcade, there is a bug in the map viewer which prevents it from working properly. Below is a workaround which I tested and was successfully able to implement in my map:
I tested this and it worked. I would recommend testing in a copy of your web map and copying/pasting default JSON into Notepad just in case.
Hi, Erica!
I was just trying to do the same thing, with more added hurdle - I needed to filter only certain features within a layer based on view scale. I ended up working out a solution that might be easier than editing the JSON.
In an expression, I mapped binary threshold values in variables with an IIf(), and set numeric values based on those thresholds. Then I simply multiplied those variables together. In my case, any feature with a program type of 'adaptive management' has a value of 0, and all features have a value of 100 when zoomed in beyond 1:50,000. This means that when I zoom in, my adaptive management features are still 0 (0*100) and all my other features are at 10,000 (100*100). Then I simply set my transparency slider accordingly.
I think your situation might be easier, because you only need the one variable. Hope this helps and isn't too confusing of a walkthrough!
Hi Josh,
Thanks for sharing that example - I'll give it a try. I was actually going to try it out this morning, but when I open the Map Viewer (in Chrome or Firefox) and select the layer, there is no longer a "transparency by attribute" option under the symbology settings. I'm mystified.