AGOL Arcade expressions to change symbol based on scale

1157
3
09-16-2020 07:31 AM
SB5
by
New Contributor

Hello. I would like to change the symbol based on the scale/zoom level. I have found good directions on how to change the size of the symbol based on scale using Arcade expressions, but not how to change the actual symbol. I have a custom image that I plan to use when the user has zoomed in beyond 1:50 000, but this symbol will not look nice when shrunk in size. I therefore want my point layer to be symbolised with a simple circle when zoomed out beyond 1:50 000. Is this possible?

 

Thanks in advance.

0 Kudos
3 Replies
XanderBakker
Esri Esteemed Contributor

Hi S B ,

You can use an expression like the one below to define a symbol based on the view scale of the map:

var scale = $view.scale;
if (scale > 50000) {
    return "Description for > 50000 symbol";
} else {
    return "Description for <= 50000 symbol";
}
0 Kudos
SB5
by
New Contributor

Hi and thanks for your swift reply Xander Bakker

A follow-up question: How do I specify the different symbols? For the custom symbol I have a URL, but the circle symbol I want to use when it is zoomed out beyond 1:50 000 is from the AGOL symbol Library. How to I get that in there?

Thanks again.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi sbreckan ,

After you define the expression, you will only see the symbols corresponding to the current scale. In case you have a single symbol, this is not a problem, since you can use the "Other" option to define the alternative symbol. As shown below when the scale is 50K or more, the symbol is a simple square:

When we zoom in one step (view scale below 50K), the symbols change to be a larger house. You can define any symbol including an image using an URL:

0 Kudos