Select to view content in your preferred language

Character marker support

171
2
2 weeks ago
MinhHoangf
Emerging Contributor

I'm converting ArcGIS Pro SDK to ArcGIS .Net SDK, i have some predefined symbols, which heavily depend on CIMCharacterMarker. I use Pro SDK to export it to json, and then read it in .net SDK using Symbol.FromJson method, create graphic from polyline and this symbol. It display on map, but font family is not correct even when custom font is installed, and runtime type of it's symbol layers is UnknownSymbolLayer, so i cannot change symbol color, size,... at runtime. Why ArcGIS runtime sdk does not support character marker? Are you have any plan to support it in near future?

Below is my symbol with character marker json:

{
"type": "CIMLineSymbol",
"symbolLayers": [
        {
"type": "CIMCharacterMarker",
"enable": true,
"anchorPoint": {
"x": -16,
"y": 0
            },
"anchorPointUnits": "Absolute",
"dominantSizeAxis3D": "Y",
"size": 20,
"billboardMode3D": "FaceNearPlane",
"markerPlacement": {
"type": "CIMMarkerPlacementAlongLineSameSize",
"placePerPart": true,
"angleToLine": true,
"endings": "NoConstraint",
"offsetAlongLine": 10.5,
"placementTemplate": [
11
                ]
            },
"characterIndex": 76,
"fontFamilyName": "GISPatternFont",
"fontStyleName": "General",
"fontType": "Unspecified",
"scaleX": 1,
"symbol": {
"type": "CIMPolygonSymbol",
"symbolLayers": [
                    {
"type": "CIMSolidFill",
"enable": true,
"color": {
"type": "CIMRGBColor",
"values": [
0,
0,
0,
100
                            ]
                        }
                    }
                ],
"angleAlignment": "Map"
            },
"scaleSymbolsProportionally": true,
"respectFrame": true
        }
    ]
}
And some code to display it:

string file = @"E:\Json\test_character.json";
string json = File.ReadAllText(file);
Symbol symbol = Symbol.FromJson(json);

if (symbol != null)
{

var point1 = new MapPoint(11515202.196315724, 2434684.622706758, SpatialReferences.WebMercator);
var point2 = new MapPoint(11723218.630165813, 2327321.3020099374, SpatialReferences.WebMercator);
var point3 = new MapPoint(11917814.648928799, 2438039.7264785334, SpatialReferences.WebMercator);

var polyline = new Polyline([point1, point2, point3]);
var gr = new Graphic(polyline, symbol);
overlay.Graphics.Add(gr);

}

 

0 Kudos
2 Replies
dotMorten_esri
Esri Notable Contributor

The JSON symbols exported directly from Pro are not compatible with the native maps sdk. Instead you need to go through the publish process for mobile data, or create a mobile style file. That process will convert the character markers to vectors, so you won't rely on a font that isn't available on the system you're deploying to.

MinhHoangf
Emerging Contributor

Thanks for your answer. I have a .lyrx file contains all symbols, I use Share/Styles/Style items to save it to .stylx file, but when I open it in WPF, it give me error: "Symbol dictionary not supported invalid or missing densifyCurves" value. What proper way to export layer's symbology to .stylx file?

0 Kudos