Moving a Map Service Group Layer out of a Group Layer with ArcPy

المشرف العام

Administrator
طاقم الإدارة
I am struggling to move web services (tiled basemaps) out of group layers into the data frame. I've used arcpy.mapping.ListLayers to compose a list of layers, then I've ascertained what is a group layer with .isGroupLayer and I've tested the group layers name and then what it "supports". However I failed miserably to pick up weird web service group layer and move them. I've tested arcpy.mapping.AddLayer among a handful of things.

Any ideas are welcome. My desired outcome is to have no web services in group layers.



import arcpy mxd ="C:\\Data\\native.mxd" OriginMxd = arcpy.mapping.MapDocument (mxd) df = arcpy.mapping.ListDataFrames(OriginMxd)[0] for OPFSLyr in arcpy.mapping.ListLayers(OriginMxd, "", df): if str(OPFSLyr) == "Basemap": # if it's named basemap if OPFSLyr.isGroupLayer: for subLayer in OPFSLyr: print subLayer arcpy.mapping.AddLayer(df, subLayer, "BOTTOM") OriginMxd.save()

أكثر...
 
أعلى