+ Reply to Thread
Results 1 to 4 of 4

Thread: Turn layers off w/ arcpy.mapping

  1. #1
    tripp lowe
    Join Date
    Apr 2010
    Posts
    17
    Points
    1
    Answers Provided
    0


    1

    Default Turn layers off w/ arcpy.mapping

    Hey Folks,

    I hope y'all can help me get a handle on using arcpy.mapping. When I run the 4 lines below in the python window, the layers in the project are displayed. But if I uncomment "lyr.visible = False" , nothing happens - I had hoped the layer would be turned off. How would I code turning the layer off?

    Thanks,
    -Tripp

    import arcpy
    mxd = arcpy.mapping.MapDocument("CURRENT")
    for lyr in arcpy.mapping.ListLayers(mxd):
    print lyr.name
    # lyr.visible = False

  2. #2
    Niklas Norrthon
    Join Date
    Dec 2009
    Posts
    121
    Points
    3
    Answers Provided
    0


    1

    Default Re: Turn layers off w/ arcpy.mapping

    arcpy.RefreshTOC()
    arcpy.RefreshActiveView()

  3. #3
    tripp lowe
    Join Date
    Apr 2010
    Posts
    17
    Points
    1
    Answers Provided
    0


    0

    Default Re: Turn layers off w/ arcpy.mapping

    Perfect. Thanks.

  4. #4
    Jeffrey Barrette

    Join Date
    Oct 2009
    Posts
    714
    Points
    201
    Answers Provided
    64


    1

    Default Re: Turn layers off w/ arcpy.mapping

    Note: the Refresh functions are only needed when referencing a map document using the "CURRENT" keyword. Not all functions automatically refresh the current ArcMap application.

    When referencing a map document via a system path, the refresh functions are not required.

    Jeff

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts