Select to view content in your preferred language

Getting the Webstyle symbols

640
3
Jump to solution
06-26-2023 01:02 AM
KarthikeyanShanmugam
Emerging Contributor

Hello

 

I am trying to render the list of the available webstyle symbols (https://developers.arcgis.com/javascript/latest/visualization/symbols-color-ramps/esri-web-style-sym...) outside the map. Is there any api which I can access to get the webstyle symbol thumbnail and the name. 

Any suggestions would be helpful. 

Thank you.

0 Kudos
2 Solutions

Accepted Solutions
Sage_Wall
Esri Contributor

Hi @KarthikeyanShanmugam ,

You can use the symbolUtils.RenderPreviewHTML  method to generate a preview image of any symbol in any DOM element.  Here is a simple codepen showing it in action. https://codepen.io/sagewall/pen/XWyparb

View solution in original post

AnneFitz
Esri Regular Contributor

I'd also recommend looking at this Adjust marker placement in polygon symbols sample, specifically the initializeWebStyles function on line 271. This demonstrates how you can use esri/request to fetch the Web Style JSON, and use that to find the name and image for each symbol in the style. Hope this helps!

View solution in original post

3 Replies
Sage_Wall
Esri Contributor

Hi @KarthikeyanShanmugam ,

You can use the symbolUtils.RenderPreviewHTML  method to generate a preview image of any symbol in any DOM element.  Here is a simple codepen showing it in action. https://codepen.io/sagewall/pen/XWyparb

AnneFitz
Esri Regular Contributor

I'd also recommend looking at this Adjust marker placement in polygon symbols sample, specifically the initializeWebStyles function on line 271. This demonstrates how you can use esri/request to fetch the Web Style JSON, and use that to find the name and image for each symbol in the style. Hope this helps!

KarthikeyanShanmugam
Emerging Contributor

Thank you @Sage_Wall  @AnneFitz . Both of them worked. 

0 Kudos