1

I have DDP index, and within each index several sets of polygons from another layer.For each index I would like to display each polygon within that index and export that to a PDF. I can pan to DDP index and set a constant scale in this case 1:24k. I would like to use the index page for my extent and then for each polygon within that extent export a PDF only showing one polygon. An arcpy.mapping solution seems to be the best option. as a page definition query seems to be limited to one query per index without much control of what is going to go into the query, other than the page index number.

Below is an illustration:enter image description here

In this example 019 purple with grey boarders is the index, I want to maintain the extent of the index and export a map for each blue polygon(10 and 1) which is stored in another layer

  • 2
    Welcome to GIS SE! As a new user be sure to take the Tour. What happened when you tried to use File | Export Map to do this? It should be straightforward so if it is not, perhaps re-read that part of the documentation, try again, and if still unsuccessful then use the edit button to revise your question. – PolyGeo Nov 10 '15 at 23:21
  • 2
    Your question is somewhat vague. However, it sounds like you want to turn on Page Definition Queries – Fezter Nov 10 '15 at 23:32
  • @Fezter I wondered whether that might be what the question was actually about too, but I think page definition queries have one extra level of difficulty for someone new to DDP like this user appears to be. I'm going to vote for this question to go On Hold for its asker to clarify what is being asked and what has been tried. – PolyGeo Nov 10 '15 at 23:42
  • I agree with Fezter. You're trying to use two DDP indexes at the same time, which you can't do. The definition queries will solve it, but since unlike the example you want multiple pages for a given extent, each with a unique polygon (whereas the example shows all polygons within an extent), you would need to duplicate each of your index polygons once for each of the subject polygons that fall within it. If you don't care about having the same extent, you could just use the subject polygons as the index and set a constant 24k scale. – Chris W Nov 11 '15 at 1:00
  • I think a picture would help clarify what is being asked here. I find the opening sentence quite confusing "I have DDP index, and within each index several sets of polygons from another layer". Do you mean "I have the DDP index layer, and within each index polygon I am displaying several sets of polygons from other layers", or something else? – PolyGeo Nov 11 '15 at 1:03
1
import arcpy
mxd = arcpy.mapping.MapDocument("Current")
df = arcpy.mapping.ListDataFrames(mxd,"layers")[0]
crLyr = arcpy.mapping.ListLayers(mxd)[2]
lyr = arcpy.mapping.ListLayers(mxd)[3]
legend = arcpy.mapping.ListLayoutElements(mxd,"LEGEND_ELEMENT","Legend")[0]
for pageNum in range(1, mxd.dataDrivenPages.pageCount +1,1):
    mxd.dataDrivenPages.currentPageID = pageNum
    rowValue = str(mxd.dataDrivenPages.pageRow.getValue("COMINDEX"))
    query = 'COMINDEX = \'%s\'' % rowValue
    lyr.definitionQuery = query
    rows = arcpy.da.SearchCursor(lyr,["Owner_ID","COMINDEX","SmpleNam"])
    for row in rows:
       v2 = row[0]
       v1 = row[1]
       if(v2<> ''):
           query2 = "%s AND \"Owner_ID\"= %s" % (query,v2)
           print query2
           lyr.definitionQuery = query2
           crLyr.definitionQuery = query2
           legend.title = row[3]
           arcpy.mapping.ExportToPDF(mxd,r"path""" + row[3] +str(v2) + ".pdf")

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.