Select to view content in your preferred language

Create a MultiLayerPointSymbol from SVG

449
2
Jump to solution
12-23-2024 11:59 AM
KarenRobine1
Regular Contributor

I'm using the RenderMultilayerSymbols.xaml.cs sample to create a MultiLayerPointSymbol. The AddPointGraphicsWithMarkerSymbols method uses the following example:

Geometry vectorElementGeometry = Geometry.FromJson("{\"rings\":[[[0.0,2.5],[2.5,0.0],[0.0,-2.5],[-2.5,0.0],[0.0,2.5]]]}");

However, I have an SVG Path I want to convert.  The path format is the following:

M16,3.5c-4.142,0-7.5,3.358-7.5,7.5c0,4.143,7.5,18.121,7.5,18.121S23.5,15.143,23.5,11C23.5,6.858,20.143,3.5,16,3.5z M16,14.584c-1.979,0-3.584-1.604-3.584-3.584S14.021,7.416,16,7.416S19.584,9.021,19.584,11S17.979,14.584,16,14.584z

In the past, you could convert SVG to Geometry using esriSMSPath (JavaScript). But not sure how to get my SVG format to Geometry? (FYI: The Path format represents a Map Pin icon..

0 Kudos
1 Solution

Accepted Solutions
PreetiMaske
Esri Regular Contributor

ArcGIS Maps SDK for Native apps do not support SVG symbols. One possible alternative is to use this online tool to convert SVG to CIM https://utility.arcgisonline.com/arcgis/rest/services/Utilities/Symbols/SymbolServer/generateSymbol

Once you get CIM json you can directly create a symbol by passing CIM json to Symbol.FromJson()

https://developers.arcgis.com/net/api-reference/api/net/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Symbol...

Hope this helps!

View solution in original post

2 Replies
PreetiMaske
Esri Regular Contributor

ArcGIS Maps SDK for Native apps do not support SVG symbols. One possible alternative is to use this online tool to convert SVG to CIM https://utility.arcgisonline.com/arcgis/rest/services/Utilities/Symbols/SymbolServer/generateSymbol

Once you get CIM json you can directly create a symbol by passing CIM json to Symbol.FromJson()

https://developers.arcgis.com/net/api-reference/api/net/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Symbol...

Hope this helps!

KarenRobine1
Regular Contributor

Perfect!!! Thank  you. Exactly what I needed.

0 Kudos