Hi All,
We are using ESRI ArcGIS Runtime in a .NET csproj. We use the following nugets:
<PackageReference Include="Esri.ArcGISRuntime" Version="200.7.0" />
<PackageReference Include="Esri.ArcGISRuntime.Toolkit.WPF" Version="200.7.0" />
We are trying to create a FeatureLayer with Polygon Symbols, and with each Polygon UI being controlled by attributes on the feature. We are mainly looking to control - the width of the polygon line, the color of the polygon line and the fill color of the polygon.
We create our feature table:
//polygon as feature
List<Field> zoneFields = new List<Field>();
Field zoneNameField = Field.CreateString("name", null, 50);
zoneFields.Add(zoneNameField);
Field zoneLineColorField = new Field(FieldType.Text, "linecolor", null, 50);
zoneFields.Add(zoneLineColorField);
Field zoneFillColorField = new Field(FieldType.Text, "fillcolor", null, 50);
zoneFields.Add(zoneFillColorField);
Field zoneLineWidthField = Field.CreateDouble("linewidth");
zoneFields.Add(zoneLineWidthField);
Field zoneFillWidthField = new Field(FieldType.Float64, "fillwidth", null, 0);
zoneFields.Add(zoneFillWidthField);
_zoneFeatureTable = new FeatureCollectionTable(zoneFields, GeometryType.Polygon, SpatialReferences.Wgs84);
Here is the JSON for the CIMSymbol
const string zoneFeatureJSON = """
{
"type": "CIMSymbolReference",
"symbol": {
"type": "CIMPolygonSymbol",
"primitiveName": "lineoverride",
"symbolLayers": [
{
"type": "CIMSolidStroke",
"primitiveName": "lineoverride",
"enable": true,
"capStyle": "Round",
"joinStyle": "Round",
"lineStyle3D": "Strip",
"miterLimit": 10,
"width": 1,
"color": [
0,
0,
0,
255
]
},
{
"type": "CIMHatchFill",
"enable": true,
"lineSymbol": {
"type": "CIMLineSymbol",
"symbolLayers": [
{
"type": "CIMSolidStroke",
"primitiveName": "lineoverride",
"enable": true,
"capStyle": "Round",
"joinStyle": "Round",
"lineStyle3D": "Strip",
"miterLimit": 10,
"width": 1,
"color": [
0,
0,
0,
255
]
}
]
},
"rotation": 45,
"separation": 5
}
],
"animations": []
},
"primitiveOverrides": [{
"type": "CIMPrimitiveOverride",
"primitiveName": "lineoverride",
"propertyName": "Width",
"valueExpressionInfo": {
"type": "CIMExpressionInfo",
"title": "linetitle",
"name": "linename",
"expression": "$feature.linewidth",
"returnType": "Default"
}
}]
}
""";
We create the Symbol and Renderer using the JSON:
var zoneSymbol = Symbol.FromJson(zoneFeatureJSON);
_zoneFeatureTable.Renderer = new SimpleRenderer(zoneSymbol);
We create a Feature using the FeatureTable:
var zoneFeature = _zoneFeatureTable.CreateFeature();
zoneFeature.SetAttributeValue(zoneNameField, $"ZoneFeature1");
zoneFeature.SetAttributeValue(zoneLineColorField, "#0000FF");
zoneFeature.SetAttributeValue(zoneFillColorField, "#FF0000");
zoneFeature.SetAttributeValue(zoneLineWidthField, 5.0);
zoneFeature.SetAttributeValue(zoneFillWidthField, 2.0);
The issue is that the Symbol does NOT use the value of "linewidth" from Feature for the override.
In this particular case, I would expect it to use the value of 5.0 from the Feature. But it still uses the default of 1.0 from the Symbol JSON.
Is this functionality supposed to be working in ESRI ArcGIS Runtime?
If it works, can you point me to a working example, so that I can see what I am doing wrong (or please point what we are doing wrong).
Thank you.
Solved! Go to Solution.
>Is this functionality supposed to be working in ESRI ArcGIS Runtime?
ArcGIS Maps SDK for Native Apps currently does not support primitiveOverrides. There is some support to honor them but is limited to DictionaryRenderer using military standards like mil2525d etc.
We already have this feature on priority list for near future release, but there isn't a definitive timeline yet. I will add your case to our internal issue and will keep you updated as we make progress on this feature.
>Is this functionality supposed to be working in ESRI ArcGIS Runtime?
ArcGIS Maps SDK for Native Apps currently does not support primitiveOverrides. There is some support to honor them but is limited to DictionaryRenderer using military standards like mil2525d etc.
We already have this feature on priority list for near future release, but there isn't a definitive timeline yet. I will add your case to our internal issue and will keep you updated as we make progress on this feature.
Thank you so much for the super fast response.
Eagerly waiting for this to be implemented.
Have a great day.
Thanks.
You could probably achieve something close to this using UniqueValueRenderer or ClassBreaksRenderer, as long as the number of unique combinations isn't too great.