Select to view content in your preferred language

Allow users to change the attribute used for the symbology

2601
13
11-08-2023 05:41 AM
JasonBOCQUET
Frequent Contributor

Hello Community,

 

I have one problem that I have to resolve to improve the ergonomy of my application.

I have socio-demographic feature layer with many columns that is interesting to represent in a map by point.

But, if I want to represent all of this information in a map, I have to duplicate my Feature Layer for each attribute that I need to represent in the map.

 

It is better if I can use only one Feature Layer and if I can permit to change which attribute have to be visualized on the map. It is possible ? 

Each attribute selected have to charge with a symbology associated who is parameter in the Map Viewer if it's possible ?

 

Thanks 🙂

13 Replies
JeffreyThompson2
MVP Frequent Contributor

I'm not entirely sure what you are asking.

If you want your symbology to vary by attribute, there is an option to do that in the webmap.

If you want to show only a specific attribute at a time, you can use the Filter widget.

If you want the user to be able to change the symbology at runtime, you will need to build a custom widget in Developer Edition.

GIS Developer
City of Arlington, Texas
0 Kudos
JasonBOCQUET
Frequent Contributor

Hello,

I want to have on my Map:

One Feature Layer with the possibility to choice WHICH Attribute must be mapped. And for each of this attribute, the symbology is pré-parameter and would be loaded in fonction of the choice.

 

The problem that I have, if I  want to map 10 different attributes, I have to duplicate 10 times my feature layer to allow the user to choice each attributes he wants to see in the map. But it would be better if the user choice the attribute with only one feature layer rather than choice between 10 different layer what he want to see.

 

It's more understandable ? 

0 Kudos
JeffreyThompson2
MVP Frequent Contributor

It sounds like you should be using the Filter widget.

https://developers.arcgis.com/experience-builder/guide/filter-widget/

GIS Developer
City of Arlington, Texas
0 Kudos
JasonBOCQUET
Frequent Contributor

If I use the Filter widget I can only showing information depending of attribute.

But I want to colour my point in fonction of ONE attribute, and allow to users the possibility to click on another attribute to see another color depending of the second attribute selected. All of this, without to use multiple layers. I want to do this with only one layer.

 

Filter widget can't color my map in fonction of attribute. If i set my map with a symbology on the attribute 1, if I filter on attribute 2 or 3 it doesn't change the symbology, it stay on the attribute 1. I want to switch with another symbology for another attribute, on the same layer.

0 Kudos
JeffreyThompson2
MVP Frequent Contributor

Anything involving changing the symbology at runtime will require building a custom widget. 

GIS Developer
City of Arlington, Texas
0 Kudos
JasonBOCQUET
Frequent Contributor

Ok, but it's technically possible ?

I can prepare each symbology for each attribute, stock them and call them on my custom widget, depending of which attribute the user choice ?

 

I'm very not convinced to duplicate my layer for each attribute I need to represent. I'm afraid of having a super long layer list which is indigestible for the user. But I have too many attribute to map.

0 Kudos
JeffreyThompson2
MVP Frequent Contributor

Yes. It is possible. Create a button for each attribute that activates a definitionExpression and alters the symbology of the layer.

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#definiti...

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer

GIS Developer
City of Arlington, Texas
0 Kudos
JasonBOCQUET
Frequent Contributor

Thanks ! It alter the symbology by modify the current layer or it create a new Feature Layer ?

0 Kudos
JeffreyThompson2
MVP Frequent Contributor

By using layer.renderer as in the example linked above, you will be able to alter the symbology of the current layer without needing to create new feature layers.

GIS Developer
City of Arlington, Texas
0 Kudos