Select to view content in your preferred language

Fetch icons/symbology directly from feature layer into ArcGIS List

814
5
09-05-2023 12:36 PM
Shubhreet
Occasional Contributor

Hello,

I am configuring a dashboard where I used a list widget and would like to display the right icons besides the listed features.

I have used arcade coding to get the output of this list which is derived from one of the feature layers used in the web map present in my dashboard. I am aware that to get the list icons, one can simply choose Configure>List>Line item icon>Symbol.  But this way, my list widget is not able to draw the right symbology of the feature layer (red colored circles) as shown in the screenshot below instead it just draws the default ArcGIS symbology for point geometry (reddish-orange-colored circles). 

Is there a way to directly the fetch the symbology/icon from the feature layer into the list widget, maybe through advanced formatting or so? 

Shubhreet_0-1693942475170.png

 

0 Kudos
5 Replies
jcarlson
MVP Esteemed Contributor

I don't think you can. In Arcade, Feature and FeatureSet objects don't include any information about the symbology. In general, the feature icon is useless for Data Expressions.

However! Depending on how complex your symbology is, you can use Advanced Formatting and SVGs to recreate your icons in the list, that way each feature can have a data-driven symbol that updates with the layer. More tedious to set up, but definitely doable. I can dig up an example if you like, but similar posts are here on the Community already, and you could probably find them with a search.

- Josh Carlson
Kendall County GIS
0 Kudos
Shubhreet
Occasional Contributor

Thanks @jcarlson . As per your suggestion, I just tried advanced formatting in the List widget using SVG code but could not get the desired result. Below is my code. Could you please take a look to suggest any improvement(s)?

Please note: I am trying to display only one icon (red colored circle) which is associated with one of my fields in the attribute table. The name of the field is 'OutbreakStatus' which can have only two values - 'Yes' or 'No'. The output of the List only includes 'Yes' values for the 'OutbreakStatus' and hence the icons of those outputs should be all same and show only red circles. 

 

var red_circle = `<svg height="100" width="100">
  <circle cx="50" cy="50" r="10" stroke="maroon" stroke-width="3" fill="red" />
  </svg>`

// set icon var by attribute
var icon = Decode($datapoint['OutbreakStatus'],
    'Yes', red_circle,'',)

return {
  textColor: '',
  backgroundColor: '',
  separatorColor:'',
  selectionColor: '',
  selectionTextColor: '',
     attributes: {
     icon
   }
}
0 Kudos
jcarlson
MVP Esteemed Contributor

Oh! If the icon is the same for each row, you don't need Arcade at all. In the line item template, click to view the source and just drop in your <svg>...</svg> tags. You'll probably need a couple of divs to get them aligned nicely.

- Josh Carlson
Kendall County GIS
0 Kudos
Shubhreet
Occasional Contributor

Thanks @jcarlson for sharing your idea. I did exactly the same as you suggested but still cannot see the desired icon instead only the default icons. 

Shubhreet_0-1694196886935.png

 

0 Kudos
Shubhreet
Occasional Contributor

Hello @jcarlson .  I was wondering if you had a chance to look into my latest reply to this post.

Thanks in advance. 

0 Kudos