<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Automatically exporting maps through layer toggle in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/automatically-exporting-maps-through-layer-toggle/m-p/1248990#M64322</link>
    <description>&lt;P&gt;Hi, I have a list of layers that I want mapped.&amp;nbsp; the layers are a mix of raster / vector but the map extent is a global and consistent regardless of the layer.&amp;nbsp; The legend attributes are the same as well, just the legend title (name of layer) would need to change.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to automatically cycle through the list of layers turning one on at a time, updating legend name, and exporting this as a map?&amp;nbsp; Basically, the same as data driven pages but instead of cycling through various features and changing extents, the extent stays the same but the layers are changing.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advise welcome!&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jan 2023 09:22:09 GMT</pubDate>
    <dc:creator>CFrost</dc:creator>
    <dc:date>2023-01-18T09:22:09Z</dc:date>
    <item>
      <title>Automatically exporting maps through layer toggle</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/automatically-exporting-maps-through-layer-toggle/m-p/1248990#M64322</link>
      <description>&lt;P&gt;Hi, I have a list of layers that I want mapped.&amp;nbsp; the layers are a mix of raster / vector but the map extent is a global and consistent regardless of the layer.&amp;nbsp; The legend attributes are the same as well, just the legend title (name of layer) would need to change.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to automatically cycle through the list of layers turning one on at a time, updating legend name, and exporting this as a map?&amp;nbsp; Basically, the same as data driven pages but instead of cycling through various features and changing extents, the extent stays the same but the layers are changing.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advise welcome!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 09:22:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/automatically-exporting-maps-through-layer-toggle/m-p/1248990#M64322</guid>
      <dc:creator>CFrost</dc:creator>
      <dc:date>2023-01-18T09:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically exporting maps through layer toggle</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/automatically-exporting-maps-through-layer-toggle/m-p/1249007#M64327</link>
      <description>&lt;P&gt;You can do that with a little Python. A quick-and-dirty approach:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;layout_name = "Layout"
locked_layers = ["World_Imagery"]  # these layers will not change visibility
export_folder = "N:/.../temp"

# get the layout, its map frame, and its legend
aprx = arcpy.mp.ArcGISProject("current")
layout = aprx.listLayouts(layout_name)[0]
mapframe = layout.listElements("MAPFRAME_ELEMENT")[0]
legend = layout.listElements("LEGEND_ELEMENT")[0]

# get the layers
layers = [
    layer
    for layer in mapframe.map.listLayers()
    if layer.name not in locked_layers
    and layer.supports("visible")
    and layer.name == layer.longName
    ]
# for each layer
for layer in layers:
    print(f"Exporting layer {layer.name}")
    # make all layers invisible
    for other_layer in layers:
            other_layer.visible = False
    # make the layer visible
    layer.visible = True
    # change the legend title
    legend.title = layer.name
    # export the layout
    layout.exportToPNG(f"{export_folder}/Export_Layer_{layer.name}.png")&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 18 Jan 2023 12:13:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/automatically-exporting-maps-through-layer-toggle/m-p/1249007#M64327</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-01-18T12:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically exporting maps through layer toggle</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/automatically-exporting-maps-through-layer-toggle/m-p/1249009#M64328</link>
      <description>&lt;P&gt;HI Johannes, this looks really promising!&amp;nbsp; Would I simply amend the code and run in the arcpro python window?&amp;nbsp; Or outside of pro?&amp;nbsp; Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 12:18:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/automatically-exporting-maps-through-layer-toggle/m-p/1249009#M64328</guid>
      <dc:creator>CFrost</dc:creator>
      <dc:date>2023-01-18T12:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically exporting maps through layer toggle</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/automatically-exporting-maps-through-layer-toggle/m-p/1249016#M64329</link>
      <description>&lt;P&gt;Yeah, change lines 1, 2, 3, and 30 (if you want to export to a different format). Copy paste into the Pro Python window, execute.&lt;/P&gt;&lt;P&gt;You should be able to run that as a standalone script outside of Pro. For that, use the project path in line 6 instead of "current". I haven't tested that, though.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 12:42:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/automatically-exporting-maps-through-layer-toggle/m-p/1249016#M64329</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-01-18T12:42:14Z</dc:date>
    </item>
  </channel>
</rss>

