Select to view content in your preferred language

Change width of frame outline of mil2525d symbols with dictionary script

1865
12
Jump to solution
10-30-2023 05:37 AM
imbachb
Regular Contributor

I'd like to change the width of the frame outline of certain mil2525d symbols via dictionary script. The symbol with key 0_101_0 is defined like so:

radimbachb_0-1698669332140.png

 

{
    "type": "CIMPointSymbol",
    "symbolLayers": [
        {
            "type": "CIMVectorMarker",
            "enable": true,
            "anchorPointUnits": "Relative",
            "dominantSizeAxis3D": "Z",
            "size": 64,
            "billboardMode3D": "FaceNearPlane",
            "frame": {
                "xmin": 0,
                "ymin": 0,
                "xmax": 612,
                "ymax": 792
            },
            "markerGraphics": [
                {
                    "type": "CIMMarkerGraphic",
                    "geometry": {
                        "rings": [
                            [
                                [
                                    391,
                                    278
                                ],
                                ...
                            ]
                        ],
                        "spatialReference": {
                            "wkid": null
                        }
                    },
                    "symbol": {
                        "type": "CIMPolygonSymbol",
                        "symbolLayers": [
                            {
                                "type": "CIMSolidFill",
                                "enable": true,
                                "primitiveName": "frame_fill",
                                "color": [
                                    255,
                                    255,
                                    128,
                                    255
                                ]
                            }
                        ]
                    }
                },
                {
                    "type": "CIMMarkerGraphic",
                    "geometry": {
                        "paths": [
                            [
                                [
                                    391,
                                    278
                                ],
                                ...
                            ]
                        ],
                        "spatialReference": {
                            "wkid": null
                        }
                    },
                    "symbol": {
                        "type": "CIMPolygonSymbol",
                        "symbolLayers": [
                            {
                                "type": "CIMSolidStroke",
                                "enable": true,
                                "primitiveName": "frame_outline",
                                "capStyle": "Butt",
                                "joinStyle": "Miter",
                                "lineStyle3D": "Strip",
                                "miterLimit": 10,
                                "width": 5,
                                "color": [
                                    0,
                                    0,
                                    0,
                                    255
                                ]
                            }
                        ]
                    }
                }
            ],
            "scaleSymbolsProportionally": true,
            "respectFrame": true
        }
    ],
    "haloSize": 1,
    "scaleX": 1,
    "angleAlignment": "Display"
}

 

Using the primitive name `frame_outline` I should be able to change the width of the rendered frame outline. When I change the width in this JSON then the new width is rendered. However, when I want to do this in the dictionary script using a primitive override

`keys += ';po:frame_outline|Width|100';`

The returned keys from the dictionary script looks like

`0_101_0;po:frame_fill|Color|RGBA(0,0,0,0);po:frame_outline|Color|#FF00FF;po:frame_outline|Width|100;...`

However, the width of the rendered frame outline is still the original width...

Changing the color of the frame_outline works though with following script

`keys += ';po:frame_outline|Color|#00FF00';`

This results in the correct color applied to the frame outline.

Why does it not work with the frame_outline width? Is there no way to change the width of the frame_outline via the dictionary script? 

Many thanks!

0 Kudos
1 Solution

Accepted Solutions
Amir-Sarrafzadeh-Arasi
Frequent Contributor

Dear radimbachb,

Please find the updated version of .stylx in the attachment.

you shouold be able to modify these properties

"Size", "Width", "Color", "Rotation", "OffsetX", "OffsetY"

If you need more clarification please let me know.

 

Best of luck

Amir

Amir Sarrafzadeh Arasi

View solution in original post

12 Replies
Amir-Sarrafzadeh-Arasi
Frequent Contributor

Dear radimbachb,

I hope you are doing well when reading this message,

you can see the property names which the dictionary renderer supports,

I do not think it supports "Width".

Please check the below link for understanding better the properties of each CIM types,

https://github.com/Esri/cim-spec/blob/main/docs/v2/CIMSymbols.md#cimbackgroundcallout

 

AmirSarrafzadehArasi_0-1699609997591.png

 

you can set the size of the frame, from ArcGIS Pro style part.

I hope it helps you

Best Regards,
Amir

Amir Sarrafzadeh Arasi
imbachb
Regular Contributor

Dear Amir-Sarrafzadeh-Arasi

Many thanks for the reply and the link to the CIMSymbols documentation, this is very helpful. Since we need to modify a few hundred symbols editing them by hand in ArcGIS Pro seems a bit of a hassle. But we should be able to write a SQL script that updates the frame_outline width value in all symbol JSONs of the `.stylx` file.

0 Kudos
Amir-Sarrafzadeh-Arasi
Frequent Contributor

Hi radimbachb,
If you have the static width size you can do that, but if you want to have dynamic width size, dictionary renderer does not have property name Width.

You can try with Size . maybe it will solve your issue.

 

keys += ';po:frame_outline|Size|20';`

Best of Luck

Amir

 

Amir Sarrafzadeh Arasi
0 Kudos
imbachb
Regular Contributor

Hi Amir-Sarrafzadeh-Arasi

Setting 
`keys += ';po:frame_outline|Size|20';`
or any other value does not seem to have any effect on the rendered symbol. I also don't see the 'size' property for the CIMSolidStroke here cim-spec/docs/v2/CIMSymbols.md at main · Esri/cim-spec · GitHub.

A way to change the size of all the symbols in the dictionary I found is via ArcGIS Maps SDK is 

ArcadeExpression* arcadeExpression = new ArcadeExpression("1.5", this);
dictionaryRenderer->setScaleExpression(arcadeExpression);

But to increase readability further it would be nice to increase the width of the frame outline. This is mostly a problem when we set the symbol style's `fill` configuration to `OFF`.

radimbachb_0-1700038841259.png

0 Kudos
Amir-Sarrafzadeh-Arasi
Frequent Contributor

Hi radimbachb,

The properties which I used in my projects are:

(Color, Size, Rotation, OffsetX, and OffsetY)

I created a simple project with random data and you can find in the attachment.

I also attached the .stylx too.

I have modified the size and color of some of random points.

 

Hope it helps.

If need more information please let me know

Have a nice day

Amir

Amir Sarrafzadeh Arasi
0 Kudos
imbachb
Regular Contributor

Hi Amir-Sarrafzadeh-Arasi

Thank you for taking the time to arrange the example. It is certainly insightful.

Looking at your style's dictionary_script I saw that you only change the size of the `pn_1` element, a CIMVectorMarker. Looking at its doumentation CIMVectorMarker - Esri/cim-spec · GitHub it also does not have a `size` property. The `size` property is on its "parent", the CIMMarker CIMMarker - Esri/cim-spec · GitHub. The CIMSolidStroke is similar. It does not have a `width` property but its parent CIMStroke (CIMStroke - Esri/cim-spec · GitHub) has a `width` property.

I don't understand what the difference is... Why can we change the parent property `size` of CIMVectorMarker but not the parent property `width` of CIMSolidStroke? Are some properties simply not exposed to Arcade?

0 Kudos
Amir-Sarrafzadeh-Arasi
Frequent Contributor

Dear radimbachb,

Please find the updated version of .stylx in the attachment.

you shouold be able to modify these properties

"Size", "Width", "Color", "Rotation", "OffsetX", "OffsetY"

If you need more clarification please let me know.

 

Best of luck

Amir

Amir Sarrafzadeh Arasi
imbachb
Regular Contributor

Hi Amir-Sarrafzadeh-Arasi
Thanks for the updated example. So it seems that setting the "Width" of CIMSolidStroke works.
I realised that this indeed works inside ArcGIS Pro but not when rendering the symbols with the ArcGIS Maps SDK.
Here an example when using the style in ArcGIS Maps SDK.
radimbachb_0-1700489665960.png

The symbols go from A - H, the size is correctly changing, but not the width of the CIMSolidStroke. Maybe this is a ArcGIS Maps SDK related bug, or I'm not setting the dictionary renderer up correctly.

Since there is no issue inside ArcGIS Pro I'll create a new thread in the Native Maps SDK section. Many thanks again for the help!

0 Kudos
Amir-Sarrafzadeh-Arasi
Frequent Contributor

Dear radimbachb,

It is my pleasure,

 

if you can provide the source code and project . I can check it carefully.

you can share by email

amir@wheretech.it

 

Best regards,

Amir

Amir Sarrafzadeh Arasi