Select to view content in your preferred language

Construction Legend from AGOL Feature Service

122
1
11-15-2024 02:04 PM
MichaelWen_Timmons
Occasional Contributor

I'm trying to create images from a Feature Service to put in the legend of a web mapping application.

Since there are no 'legend' endpoints for those I need to render these images from the layer's 'drawing info'.

I cannot use the Legend widget since it is a custom application.

In JS 3.x one can use dojo/gfx to create a symbol based on the drawing info, but I don't know what's available in 4.x?

Any advice is appreciated.

0 Kudos
1 Reply
ReneRubalcava
Honored Contributor

You can use symbolUtils to help you out here.

https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-support-symbolUtils.html

const symbol = await getDisplayedSymbol(graphic);
const previewElement = await renderPreviewHTML(symbol, options);
0 Kudos