<?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: Exporting Landscape and portrait maps using arpy.datadrivenpages in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/exporting-landscape-and-portrait-maps-using-arpy/m-p/633572#M49367</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jeff,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I used this example as a template for what I wrote. The difference is I want to select from attributes rather than the page number. The work flow would go as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;User&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The user selects a group of features from the data driven pages index.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;The Script&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Create a temporary layer of the selection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. From the temp layer, select [Orientation] = "LANDSCAPE"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Export Selected features to multiple PDF [page name] on the Landscape mxd&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. From the temp layer, select [Orientation] = "PORTRAIT"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5. Export Selected features to multiple PDF [page name] on the Portrait mxd&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;6. Delete temp layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure of this is a flawed idea as I'm not sure if mapping.datadrivenpages recognizances the temporary feature layer as the input source.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Jan 2013 14:45:15 GMT</pubDate>
    <dc:creator>DavidMcDermott</dc:creator>
    <dc:date>2013-01-22T14:45:15Z</dc:date>
    <item>
      <title>Exporting Landscape and portrait maps using arpy.datadrivenpages</title>
      <link>https://community.esri.com/t5/python-questions/exporting-landscape-and-portrait-maps-using-arpy/m-p/633570#M49365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear GIS community,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am very much a Python N00b so am in need to your expertise.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Scenario: &lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using data driven pages to export to PDF. Each PDF focuses on a single polygon (in this case a postal zone) along with the relative background map. Of the 18000 polygons, 8000 would best suite a Portrait layout and 10000 would be landscape. The orientation preference is already the the data driven pages index layer. The two mxd's are identical except for their layout.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;My Aim:&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to write a python script that would allow me to export a selection of polygons (either by a simple selection or a definition query), using the correct layout. I would be in one of the mxd's when running this script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;So far:&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the script I have so far -&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import arcpy module&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Select Paramaters&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Select_Index=arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Select_Portrait_Layout = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Select_landscape_Layout = arcpy.GetParamterASText(2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Export_Location = arcpy.GetParamaterAsText(3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Local variables:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Input_Feature = Select_Index&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Output_Layer = "DDP_Index_Temp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Select_Portrait_Layout = Select_Portrait_Layout&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Select_Index = Select_Index&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Select_landscape_Layout = Select_landscape_Layout&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Export_Location = Export_Location&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxdport = arcpy.mapping.MapDocument(Select_Portrait_Layout)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxdland = arcpy.mapping.MapDocument(Select_landscape_Layout)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Make Feature Layer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.MakeFeatureLayer_management(Input_Feature, Output_Layer, "", "", "OBJECTID OBJECTID VISIBLE NONE;Shape Shape VISIBLE NONE;NAME NAME VISIBLE NONE;AREA_CODE AREA_CODE VISIBLE NONE;DESCRIPTIO DESCRIPTIO VISIBLE NONE;FILE_NAME FILE_NAME VISIBLE NONE;NUMBER NUMBER VISIBLE NONE;NUMBER0 NUMBER0 VISIBLE NONE;POLYGON_ID POLYGON_ID VISIBLE NONE;UNIT_ID UNIT_ID VISIBLE NONE;CODE CODE VISIBLE NONE;HECTARES HECTARES VISIBLE NONE;AREA AREA VISIBLE NONE;TYPE_CODE TYPE_CODE VISIBLE NONE;DESCRIPT0 DESCRIPT0 VISIBLE NONE;TYPE_COD0 TYPE_COD0 VISIBLE NONE;DESCRIPT1 DESCRIPT1 VISIBLE NONE;Shape_Length Shape_Length VISIBLE NONE;Shape_Area Shape_Area VISIBLE NONE;Orientation Orientation VISIBLE NONE")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Select Portrait&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.SelectLayerByAttribute_management(Output_Layer, "NEW_SELECTION", "\"Orientation\" = 'PORTRAIT'")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Process: Export Portrait&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxdport.dataDrivenPages.exportToPDF(Export_Location,'SELECTED')&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Select Landscape&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.SelectLayerByAttribute_management(Output_Layer, "NEW_SELECTION", "\"Orientation\" = 'LANDSCAPE'")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Process: Export Landscape&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxdland.dataDrivenPages.exportToPDF(Export_Location,'SELECTED') &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;The issue:&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Simply put, it doesn't work. I keep getting the error the following error - &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]20891[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For this I am guessing its that i'm trying to export selected but from the wrong feature....??&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;help&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;David McDermott&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Jan 2013 11:19:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporting-landscape-and-portrait-maps-using-arpy/m-p/633570#M49365</guid>
      <dc:creator>DavidMcDermott</dc:creator>
      <dc:date>2013-01-20T11:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Landscape and portrait maps using arpy.datadrivenpages</title>
      <link>https://community.esri.com/t5/python-questions/exporting-landscape-and-portrait-maps-using-arpy/m-p/633571#M49366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you looked at this facing pages example.&amp;nbsp; The sample uses two different MXDs similar to what you are trying to do.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/#/Creating_a_map_book_with_facing_pages/00s90000002p000000/"&gt;http://resources.arcgis.com/en/help/main/10.1/#/Creating_a_map_book_with_facing_pages/00s90000002p000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2013 13:55:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporting-landscape-and-portrait-maps-using-arpy/m-p/633571#M49366</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2013-01-22T13:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Landscape and portrait maps using arpy.datadrivenpages</title>
      <link>https://community.esri.com/t5/python-questions/exporting-landscape-and-portrait-maps-using-arpy/m-p/633572#M49367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jeff,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I used this example as a template for what I wrote. The difference is I want to select from attributes rather than the page number. The work flow would go as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;User&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The user selects a group of features from the data driven pages index.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;The Script&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Create a temporary layer of the selection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. From the temp layer, select [Orientation] = "LANDSCAPE"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Export Selected features to multiple PDF [page name] on the Landscape mxd&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. From the temp layer, select [Orientation] = "PORTRAIT"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5. Export Selected features to multiple PDF [page name] on the Portrait mxd&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;6. Delete temp layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure of this is a flawed idea as I'm not sure if mapping.datadrivenpages recognizances the temporary feature layer as the input source.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2013 14:45:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporting-landscape-and-portrait-maps-using-arpy/m-p/633572#M49367</guid>
      <dc:creator>DavidMcDermott</dc:creator>
      <dc:date>2013-01-22T14:45:15Z</dc:date>
    </item>
  </channel>
</rss>

