AnsweredAssumed Answered

Symbol object to image (svg)

Question asked by canadajebus on Feb 24, 2016
Latest reply on Mar 15, 2017 by JordanBaumgardner_GIS

I have a custom Legend widget which I made some time ago and have been using.  It normally works by doing an esriRequest to get the Legend info for that layer. 

 

What I've encountered though is some layers do not have this info, example: http://services.arcgis.com/P3ePLMYs2RVChkJx/ArcGIS/rest/services/World_UTM_Grid/FeatureServer/0

 

What I would like to do is use the Symbol object which I can get from the Renderer to create an image that I can use for the legend.  I'm not particular on the format, but I've tried using the standard Legend widget with a layer like this and it creates an SVG path.

 

How does the default Legend widget do this? Symbol -> SVG path.

 

The markup for the service above would some create this:

<path transform="matrix(1.00000000,0.00000000,0.00000000,1.00000000,15.00000000,15.00000000)" dojoGfxStrokeStyle="solid" stroke-dasharray="none" fill-rule="evenodd" d="M-10-10L 10 0L 10 10L-10 10L-10-10" path="M -10,-10 L 10,0 L 10,10 L -10,10 L -10,-10 E" stroke-miterlimit="4" stroke-linejoin="miter" stroke-linecap="butt" stroke-width="1" stroke-opacity="1" stroke="rgb(105, 105, 105)" fill-opacity="0.5019607843137255" fill="rgb(211, 211, 211)"></path>

 

Thanks in advance!

Outcomes