AnsweredAssumed Answered

How do you add a layer into a group layer in ArcGIS Online using Python?

Question asked by dcassiday_blueraster on Sep 27, 2018

I am writing a Python script to add a batch of (many) layers to an existing web scene on ArcGIS Online. All the layers are already hosted, so I'm just going to get each layer by it's item ID and add it to the web scene. Each layer needs to be added to a particular group layer in the scene. So basically I'm iterating through a CSV file with item IDs in one column and the name of the group layer in another column.


The problem is that there doesn't seem to be an easy way in the ArcGIS API to add a layer to a group layer in ArcGIS Online. What I'm really looking for is an arcgis equivalent to the arcpy function AddLayerToGroup. An alternate approach might be to add the layer and then move it to the correct group layer, but again I'm not sure if this is doable.