Are there any samples of MultilayerSymbol json files. All help really seems to indicate is that you can only load these from json, but not seeing any sample of what this json would like like and how to compose.
Thanks
-Joe
Joe Hershman were you able to figure this out this one?
Usually I would use CompositeSymbol to combine multiple symbols, such as a vehicle symbol with a fixed rotation, and an arrow or similar indicator for direction. Using CompositeSymbol, the whole symbol is rotated. What I was hoping for, was that MultilayerPointSymbol could handle this situation where one symbol is rotated, and the other is not. However, the documentation has no real documentation on what the json would look like, or what the symbol type is used for, or if it applies for my needs. I know I can use two layers with different symbology, but that eats an extra bit of extra unmanaged memory for the renderers (and it adds up), and added hassle of updating them both.
Hi,
I recently had this issue and my approach was to use ArcGIS Pro to author the symbol save the symbol style. The style files seem to be Sq-lite database files, using a Sq-Lite browser you can find in one of the tables the JSON. The symbols seem to be built from the CIM classes (e.g. ArcGIS Pro 2.3 API Reference Guide ).
Here is an example of a layered symbol for a pointMarker consisting of triangle and picture (I removed the actual base64 picture)
{
"type": "CIMPointSymbol",
"symbolLayers": [{
"type": "CIMVectorMarker",
"enable": true,
"anchorPoint": {"x": 0,"y": 0,"z": 0
},
"anchorPointUnits": "Relative",
"dominantSizeAxis3D": "Y",
"offsetY": 14,
"rotation": 180,
"size": 17,
"billboardMode3D": "FaceNearPlane",
"frame": {"xmin": -5.0,"ymin": -5.0,"xmax": 5.0,"ymax": 3.74},
"markerGraphics": [{
"type": "CIMMarkerGraphic",
"geometry": {"x": 0,"y": 0},
"symbol": {
"type": "CIMPointSymbol",
"symbolLayers": [{
"type": "CIMVectorMarker",
"enable": true,
"anchorPoint": {"x": 0,"y": 0,"z": 0},
"anchorPointUnits": "Relative",
"dominantSizeAxis3D": "Y",
"size": 5,
"billboardMode3D": "FaceNearPlane",
"frame": {"xmin": 0.0,"ymin": 0.0,"xmax": 17.0,"ymax": 17.0},
"markerGraphics": [{
"type": "CIMMarkerGraphic",
"geometry": {
"rings": [[[0.0,0.0],[8.61,14.85],[17.0,0.0],[0.0,0.0]]]},
"symbol": {
"type": "CIMPolygonSymbol",
"symbolLayers": [{
"type": "CIMSolidStroke",
"enable": true,
"capStyle": "Round",
"joinStyle": "Round",
"lineStyle3D": "Strip",
"miterLimit": 10,
"width": 0,
"color": {"type": "CIMRGBColor","values": [0,0,0,100]}
},
{
"type": "CIMSolidFill",
"enable": true,
"color": {
"type": "CIMRGBColor",
"values": [0,0,0,100]
}
}]
}
}],
"scaleSymbolsProportionally": true,
"respectFrame": true
}],
"haloSize": 0,
"scaleX": 1,
"angleAlignment": "Display"
}
}],
"scaleSymbolsProportionally": true,
"respectFrame": true
},
{
"type": "CIMPictureMarker",
"enable": true,
"anchorPoint": {"x": 0,"y": -6,"z": 0},
"anchorPointUnits": "Absolute",
"dominantSizeAxis3D": "Y",
"offsetY": 17,
"size": 32,
"billboardMode3D": "FaceNearPlane",
"invertBackfaceTexture": true,
"scaleX": 1,
"textureFilter": "Picture",
"tintColor": {"type": "CIMRGBColor","values": [255, 255,255,100]},
"url": "data:image/png;base64, <REMOVED>"
}],
"haloSize": 1,
"scaleX": 1,
"angleAlignment": "Display"
}
Hello,
If in case, you use ArcGIS Pro symbol style to create your own symbol and prefer to use in Runtime, please look at this sample:
DotNetRuntimeSamples/DicSymbolStyle at master · nagmayasmin/DotNetRuntimeSamples · GitHub
ShapefileFeatureTable myShapefile = await ShapefileFeatureTable.OpenAsync(file_shapefile_location);
// Create a feature layer to display the shapefile
FeatureLayer newFeatureLayer = new FeatureLayer(myShapefile);
string file_to_stylx = parent.FullName + "\\Data\\style.stylx";
symbolStyle = await SymbolStyle.OpenAsync(file_to_stylx);
IList<String> stringList = new List<string>();
stringList.Add("shoppingcenter01");
stringList.Add("marker01");
SimpleRenderer simpleRenderer = new SimpleRenderer(await symbolStyle.GetSymbolAsync(stringList));
newFeatureLayer.Renderer = simpleRenderer;
// Add the feature layer to the map
myMap.OperationalLayers.Add(newFeatureLayer);
As Kris mentioned, this is .sqlite geodatabase and you need to get the "key" file to identify what symbol layer you wnat to add in Runtime.
Hope that helps.
Good news: Update 5 will also ship with many more APIs available for you to do a lot of this programmatically, so you don't have to do it all via JSON.
I do still recommend using Pro to author symbols in though.
Hi, Where do you see what update 5 will have and when it will be available?
I see what Update 5 has, because I work on the product 🙂
As it hasn't shipped yet, I don't have exact release dates to share. We're getting close though...
Using MultilayerPointSymbol, am I able to do what I want to in regard to one symbol being rotating based on an attribute, and the other part of the symbol having a fix orientation? I.e the car being fixed, while arrow rotates depending on the direction?
"We're getting close though..." is good to hear (PS: I'm guessing Kris Desmet is curious, at least I am, if it is possible to see somewhere what you are currently working on while we excitedly wait for new releases ).
Per-layer rotation isn't something that's supported yet (but in the works). The only way I can think of right now is 360 Unique Values in a Unique Value Renderer 🙂
Note regarding the Symbol Layer API coming: This doesn't give you any new super-powers. It just means you don't have to use JSON as much to use your existing super powers 🙂
But I want super powers..... but at least they are in the works.
I have tried Unique Value Renderer with 12 segments, but the loading/creation of the renderers was very slow and the added unmanaged memory footprint was surprisingly high (there are multiple maps). We are fairly pressed on memory as it is, and you are currently investigating some of those issues/leaks. There were quite a few layers due to being able to show/hide based on categories, but still. Much more cost effective in terms of (load) performance and memory consumption using one layer for directional symbol, and another for fixed. That also causes some added unmanaged memory, but it performs. And we were able to trim down the categories