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.

Any thoughts how to approach this?


To do this I would use arcpy.mapping and code like this to move them off the page:

if lyr.visible == True:
    df.elementPositionX = 10 # wherever you want on the page
    df.elementPositionY = 10
    sclbr.elementPositionX = 5
    sclbr.elementPositionY = 5
    df.elementPositionX = 100  # or anywhere off the page
    df.elementPositionY = 100
    sclbr.elementPositionX = 100
    sclbr.elementPositionY = 100

where lyr is the layer, df is the data frame of the inset map and sclbr is the scale bar element.

  • Layer is in a group so test lyr.longname I suppose – nealei Feb 5 at 7:00
  • If you need help with getting a code snippet to work then please ask about that using a new question tagged ArcPy. – PolyGeo Feb 5 at 7:57
  • I don't think visible properties exist for dataframe or scalebar – nealei Feb 6 at 4:49
  • They do in ArcGIS Pro which is what I usually work with nowadays. As a workaround for ArcMap you could try using elementPositionX and elementPositionY to move them off and back on the page as needed. – PolyGeo Feb 6 at 5:49
  • Can this manage inset map frame and leader too? – nealei Feb 6 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.