I'd like to only display an inset map, inset map scale bar, frame and leader if an associated layer is displayed. Similar to Associate Point Layer, Annotation Group and Line Layer in Map Legend but for an inset map rather than annotation.
I can't put up an image through the firewall but the inset is the same as the main map at a different scale in ArcGIS 10.2.1 for Desktop under Win7. It has a few line and point layers, same labels and the scalebar.
Following on from https://gis.stackexchange.com/a/311066/121893 and using a framework from https://community.esri.com/thread/178874. This arcpy code has no affect on inset or scalebar. How can I get it to work (including where to put code in project)?
def display_layer_inset(glayername): mxd = arcpy.mapping.MapDocument('CURRENT') df = mxd.activeDataFrame df2 = arcpy.mapping.ListDataFrames(mxd, "inset") layers = arcpy.mapping.ListLayers(df) for lyr in layers: if lyr.isGroupLayer and lyr.name == glayername: print "Layer: " + glayername if lyr.visible == True: print "visible" df2.visible = True else: print "not visible" df2.visible = False # use as display_layer_inset("MyGroupLayer")
Layer: MyGroupLayer not visible