<?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 Re: Export specific polygons to jpeg in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/export-specific-polygons-to-jpeg/m-p/1070134#M61411</link>
    <description>&lt;P&gt;Are you aware of&amp;nbsp;&lt;A href="https://desktop.arcgis.com/en/arcmap/10.3/map/page-layouts/creating-data-driven-pages.htm" target="_blank"&gt;Creating Data Driven Pages—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;or is this just an arcpy learning exercise?&lt;/P&gt;</description>
    <pubDate>Sat, 19 Jun 2021 12:01:36 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2021-06-19T12:01:36Z</dc:date>
    <item>
      <title>Export specific polygons to jpeg</title>
      <link>https://community.esri.com/t5/python-questions/export-specific-polygons-to-jpeg/m-p/1070102#M61409</link>
      <description>&lt;P&gt;ArcGIS 10.1&lt;/P&gt;&lt;P&gt;Hello, I am new to using python. I have figured out how to export specific maps as a jpeg.&lt;/P&gt;&lt;P&gt;What I am trying to do now is use&amp;nbsp;python to zoom into a specific polygon in the data view and export it as a jpeg with the polygon's name.&lt;/P&gt;&lt;P&gt;For context, this will involve multiple polygons within the same shapefiles and will also need to account for multiple shapefiles of this nature.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help with this would be greatly appreciated !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;from arcpy import env&lt;BR /&gt;from arcpy import mapping&lt;BR /&gt;env.workspace = "CURRENT"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;mxd = arcpy.mapping.MapDocument("CURRENT")&lt;BR /&gt;df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]&lt;BR /&gt;for lyr in arcpy.mapping.ListLayers(mxd):&lt;/P&gt;</description>
      <pubDate>Sat, 19 Jun 2021 00:53:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-specific-polygons-to-jpeg/m-p/1070102#M61409</guid>
      <dc:creator>Kvbass</dc:creator>
      <dc:date>2021-06-19T00:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: Export specific polygons to jpeg</title>
      <link>https://community.esri.com/t5/python-questions/export-specific-polygons-to-jpeg/m-p/1070134#M61411</link>
      <description>&lt;P&gt;Are you aware of&amp;nbsp;&lt;A href="https://desktop.arcgis.com/en/arcmap/10.3/map/page-layouts/creating-data-driven-pages.htm" target="_blank"&gt;Creating Data Driven Pages—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;or is this just an arcpy learning exercise?&lt;/P&gt;</description>
      <pubDate>Sat, 19 Jun 2021 12:01:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-specific-polygons-to-jpeg/m-p/1070134#M61411</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-06-19T12:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Export specific polygons to jpeg</title>
      <link>https://community.esri.com/t5/python-questions/export-specific-polygons-to-jpeg/m-p/1070135#M61412</link>
      <description>&lt;P&gt;from&amp;nbsp;&lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-desktop/mapping/combining-data-driven-pages-with-python-and-arcpy-mapping/?rmedium=blogs_esri_com&amp;amp;rsource=/esri/arcgis/2010/12/14/combining-data-driven-pages-with-python-and-arcpy-mapping/" target="_blank" rel="noopener"&gt;Combining Data Driven Pages with Python and arcpy.mapping (esri.com)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'&lt;SPAN&gt;The following example zooms to a selected parcel, toggles on different layer visibility and exports the layout for multiple themes in order to create a parcel report with a soil map, a flood map and a zoning map:'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy, os

#Specify output path and final output PDF
outPath = r”C:MyProjectoutput\”
finalPdf = arcpy.mapping.PDFDocumentCreate(outPath + “ParcelReport.pdf”)

#Specify the map document and the data frame
mxd = arcpy.mapping.MapDocument(r”C:MyProjectMyParcelMap.mxd”)
df = arcpy.mapping.ListDataFrames(mxd, “Layers”)[0]

#Select a parcel using the LocAddress attribute and zoom to selected
parcelLayer = arcpy.mapping.ListLayers(mxd, “Parcels”, df)[0]
arcpy.SelectLayerByAttribute_management(parcelLayer, “NEW_SELECTION”, “”LocAddress” = ’519 Main St’”)
df.zoomToSelectedFeatures()

#Turn on visibility for each theme and export the page
lyrList = [“Soils”, “Floodplains”, “Zones”]
for lyrName in lyrList:
  lyr = arcpy.mapping.ListLayers(mxd, lyrName, df)[0]
  lyr.visible = True

  #Export each theme to a temporary PDF and append to the final PDF
  tmpPdf = outPath + lyrName + “_temp.pdf”
  if os.path.exists(tmpPdf):
  os.remove(tmpPdf)
  arcpy.mapping.ExportToPDF(mxd, tmpPdf)
  finalPdf.appendPages(tmpPdf)

  #Turn off layer visibility and clean up for next pass through the loop
  lyr.visible = False
  del lyr, tmpPdf
del mxd, df, finalPdf&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Jun 2021 12:58:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-specific-polygons-to-jpeg/m-p/1070135#M61412</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-06-19T12:58:28Z</dc:date>
    </item>
  </channel>
</rss>

