Hi Developers,
Background
I am developing a script to set up a Feature Layer Collection (point, polyline, polygon) including fields and styles. To set the styles, I add a renderer to the lines layer, which works fine (attached image, right side).
# Lines
unique_value_renderer = {
"renderer": {
"type": "uniqueValue",
"field1": "CATEGORY",
"defaultSymbol": {
"color": [0, 0, 255, 255],
"width": 5,
"type": "esriSLS",
},
"uniqueValueInfos": [
{
"value": "Good_Route",
"symbol": {
"color": [0, 255, 0, 255],
"width": 5,
"type": "esriSLS",
},
},
{
"value": "Blocked_Route",
"symbol": {
"color": [255, 0, 0, 255],
"width": 5,
"type": "esriSLS",
},
}
]
}
}
# Set the renderer for the feature layer
fl = FeatureLayer(url=url_lines)
fl.manager.update_definition({"drawingInfo": unique_value_renderer})
My Question
Using ArcGIS Online, I visualize the line feature layer in new Map Viewer, change the styles and save the layer (not a map, but the layer). After doing so, how can I revert back to have my renderer as default style for adding the layer to maps or visualizing the data?
What I tried
- Run above code again, no change
- Tried to understand WebStyle and set it to none
fl.manager.update_definition({"web_style_id": None})
- Compared fl.properties of both layers in screenshot attached (left: changed style online; right: API only), but did not find a difference, except the name.
Setup
- ArcGIS Online
- Visual Studio Code + Jupyter Notebook
- ArcGIS Python API Version 2.1.0.2
Edit
See attached my Notebook that shows the different behavior. Dev4 section is a Feature Layer Collection to which I made changes in symbology online. My goal is to get Dev4 Variant A running the same way as Dev5.