You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I can workaround by manipulating the JSON from the operationalLayers to create a Group Layer in the WebMap. It can be quite cumbersome and you need to have in-depth knowledge of the JSON required and how to remove your layers as single layers and add as a Group Layer.
Current Solution...
fromarcgis.gisimportGISfromarcgis.mappingimportWebMap## Access AGOLagol=GIS("home")
## access webmap itemwm_item=agol.content.get("WM_ITEM_ID")
## create WebMap objectwebmap=WebMap(wm_item)
## layers to grouplyr1=webmap.get_layer(title="Layer 1")
lyr2=webmap.get_layer(title="Layer 2")
lyr3=webmap.get_layer(title="Layer 3")
lyr4=webmap.get_layer(title="Layer 4")
## create a list of group layersgroup_lyrs= [
lyr1,
lyr2,
lyr3,
lyr4
]
## get a list of layer names to be groupeslyr_names= [lyr.titleforlyringroup_lyrs]
## create the group layer JSONgroup= {
"title" : "NPWS Designated Boundaries",
"layers" : group_lyrs,
"layerType": "GroupLayer",
"visibilityMode": "independent"
}
## we will use this list to overwrite current operationalLayers JSONnew_ol= [group]
## append all other layers into the listforlyrinwebmap.definition.operationalLayers:
iflyr.titlenotinlyr_names:
new_ol.append(lyr)
## update the operationalLayers listwebmap.definition.operationalLayers=new_ol## update the properties and webmapitem_properties= {"text":webmap.definition}
wm_item.update(item_properties=item_properties)
Describe the solution you'd like
a method for the WebMap object called group_layers() that takes in a list of layer names or layer ids from the operationalLayer.
Building on from this is would be good to be able to remove a single layer or all layers (ungroup all) from a Group Layer, possible method names from_group_to_layer() or clear_group_layer()
Describe alternatives you've considered
Shown in the python code further up.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered:
@Clubdebambos
We are working on major mapping module updates and this will be in there. We don't have a set release date but I will keep you updated when we have one.
Is your feature request related to a problem? Please describe.
I can workaround by manipulating the JSON from the operationalLayers to create a Group Layer in the WebMap. It can be quite cumbersome and you need to have in-depth knowledge of the JSON required and how to remove your layers as single layers and add as a Group Layer.
Current Solution...
Describe the solution you'd like
a method for the WebMap object called group_layers() that takes in a list of layer names or layer ids from the operationalLayer.
Building on from this is would be good to be able to remove a single layer or all layers (ungroup all) from a Group Layer, possible method names from_group_to_layer() or clear_group_layer()
Describe alternatives you've considered
Shown in the python code further up.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: