Select to view content in your preferred language

How to upload a style to ArcGIS Online, to be used in the map viewer?

137
1
03-24-2025 09:06 AM
lvgr
by
New Contributor

I would like to upload a style to ArcGIS Online so I can use it in the map viewer when viewing a layer compatible with the style.

What I've done is create a new item with (in case of a style for lines)

ip = ItemProperties(
  item_type=ItemTypeEnum.STYLE,
  title=...,
  type_keywords=["lineSymbol", "web2d"],
)
...
...add(item_properties=ip, text=style_text)

 I've added lineSymbol and web2d because it seems the viewer looks for items with these two type keywords when looking for styles.

style_text is the textual representation of a dictionary that looks like this

{
    "items": [
        {
            "name": "symbol name",
            "styleName": "style name",
            "symbol": {
                "type": "esriSLS",
                "color": [
                    0,
                    255,
                    0,
                    255
                ],
                "width": 10,
                "style": "esriSLSSolid"
            }
        }
    ],
    "metadata": {
        "styleName": "style name"
    }
}

 

The item is uploaded correctly but it doesn't show in the map viewer in the 'Styles' panel, when I try to change symbol. I think there's something wrong in the style format, but I've found no documentation for it. I'd be nice if there was a JSON Schema.

Tags (1)
0 Kudos
1 Reply
RhettZufelt
MVP Notable Contributor

Have not used python for this, but have shared a style to AGOL with Pro.

Once the style is in the Org, I opened map in map viewer, highlighted the layer, select "Styles":

RhettZufelt_0-1742856770975.png

Click on the Symbol style, then the Basic point (or whatever comes up) arrow, then click on the + sign:

RhettZufelt_1-1742856862741.png

This should let you add your new style to the web map, and can then be used for symbology.

R_

0 Kudos