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.
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":
Click on the Symbol style, then the Basic point (or whatever comes up) arrow, then click on the + sign:
This should let you add your new style to the web map, and can then be used for symbology.
R_