Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm setting up a mapbook with layered PDFs, what I have is the first map showing the extent of the grid (an overview map) with the rest of the maps showing each grid. It has been annoying to set up an overview map on the same data driven mxd, it would be much easier to export it as a seperate pdf and then merge it with the rest of the mapbook, but this loses layered pdf.

Anyway, so I have the extent and the rest of the mapbook set up - however I have a couple of issues still. I don't know how to set the symbology between the extent map and the grid maps (i.e road label with a font of 200 is huge on my grid maps). Another issue is the scale bar is tiny for the extent map and huge for the grid maps - I need it to fit both scale types. Another issue is if I put in annotations for the extent map to get around labelling - I won't be able to hide it in the grid maps. Also I am unable to hide grids for the extent map (they are too small and I don't want to show them).

So ultimately it is an issue of having the same labelling for two map types with different scales on the same mxd - if I could somehow merge the PDFs without losing the layered pdf function I could do this much easier.

share|improve this question
    
I just saw your posting and share some of your issues with map automation when different scales are involved. However, I am surprised that you are losing layering when you append PDFs together. If I get a chance over the weekend I'll knock up a code example to show you that this can work - and also will try to provide links to some forum postings about ArcPy (and Data Driven Pages) desperately needing control over reference grid intervals. –  PolyGeo Feb 17 '12 at 6:45
    
This is a link to the major issue I have with ArcPy not being able to alter the interval on reference grids/graticule in response to the varying scales of maps in a series ideas.arcgis.com/ideaView?id=087300000008MmJAAU#comments - please vote for it! For your other issues I would recommend that you create a question for each to optimise your chances of getting each answered. –  PolyGeo Feb 18 '12 at 3:22

2 Answers 2

up vote 1 down vote accepted

I just ran a test using the code below which I borrowed and cut down from the ArcGIS Desktop Blog.

import arcpy, os, string
#Create final output PDF file 
finalPdf = arcpy.mapping.PDFDocumentCreate(r"C:\Temp\test.pdf")

#Export Overview Map and append to final PDF file    
mxd = arcpy.mapping.MapDocument(r"C:\Temp\MyOverviewMap.mxd")
tmpPdf = r"C:\Temp\MyOverviewMap.pdf"
arcpy.mapping.ExportToPDF(mxd, tmpPdf)
finalPdf.appendPages(tmpPdf)
del mxd, tmpPdf

#Export Data Driven Pages and append to final PDF file    
mxd = arcpy.mapping.MapDocument(r"C:\Temp\MyAtlasPages.mxd")
tmpPdf = r"C:\Temp\MyAtlasPages.pdf"
ddp = mxd.dataDrivenPages
ddp.exportToPDF(tmpPdf, "ALL")
finalPdf.appendPages(tmpPdf)
del mxd, tmpPdf

del finalPdf

I used a map of the states of Australia (polygons) as my index and the cities of the world (points) as the only other layer and put both into a blank map.

My first Save was to create C:\Temp\MyOverviewMap.mxd and then I did a Save As to create C:\Temp\MyAtlasPages.mxd.

In that second map I ran the Data Driven Pages Setup and saved the map.

From IDLE, I then ran the Python code and the test.pdf created contained the Index map (which was layered) and a map page for each Australian state (which were also layered).

Consequently, I am unable to reproduce your issue with not being able to preserve layered PDFs when you append them.

Are you perhaps using something other than ArcPy to try and append PDF files together?

share|improve this answer
    
Hi, sorry it took so long to reply, totally forgot about posting here. Yes I have been using a free program to merge pdfs, I only came across arcpy merging today. All goes well until I try to export my data driven pages and I get this error Runtime error <type 'exceptions.AttributeError'>: PageLayoutObject: Error in exporting pages . Any idea? –  sni Feb 29 '12 at 1:17
    
Can you perhaps detail your "all goes well until" steps so that I can try to follow them and reproduce your error? For me the export of data driven pages to PDF has always worked without error so I am thinking you must be diverging from the steps I outlined above. –  PolyGeo Feb 29 '12 at 1:49
    
mxd = arcpy.mapping.MapDocument(r"P:\test_A3.mxd") tmpPdf = r"P:\Test.pdf" ddp = mxd.dataDrivenPages ddp.exportToPDF(tmpPdf, "ALL") finalPdf.appendPages(tmpPdf) del mxd, tmpPdf del finalPdf 'code' –  sni Feb 29 '12 at 2:33
    
Gah how do i post the code properly? anyway I get the error in the ddp.exportToPDF part –  sni Feb 29 '12 at 2:36

I've copied the code from your comment here so that it can be formatted easily.

mxd = arcpy.mapping.MapDocument(r"P:\test_A3.mxd") 
tmpPdf = r"P:\Test.pdf" 
ddp = mxd.dataDrivenPages 
ddp.exportToPDF(tmpPdf, "ALL") 
finalPdf.appendPages(tmpPdf) 
del mxd, tmpPdf 
del finalPdf

If this is the total code then I am thinking that your "finalPdf.appendPages(tmpPdf)" line is trying to append PDF data into a file name (r"P:\Test.pdf") which is being stored as a string.

You need to create a PDF document object (using PDFDocumentCreate) from that variable first. Perhaps do this:

mxd = arcpy.mapping.MapDocument(r"P:\test_A3.mxd") 
tmpPdf = r"P:\Test.pdf" 
finalPdf = arcpy.mapping.PDFDocumentCreate(r"P:\Test.pdf")
ddp = mxd.dataDrivenPages 
ddp.exportToPDF(tmpPdf, "ALL") 
finalPdf.appendPages(tmpPdf) 
del mxd, tmpPdf 
del finalPdf
share|improve this answer
    
Hi - I did have the create pdf object part - mine is pretty much a copy of the esri code with my file names. Anyway since I couldn't get it working I exported the maps using data driven pages from the mxds then merged them using the code here help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//… (code sample 1) which is the same thing really. Is there a way to run it as a toolbox script? –  sni Feb 29 '12 at 4:51
    
Yes - there's some good help on how to create a script tool from a Python script at help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//… –  PolyGeo Feb 29 '12 at 5:32
    
the other problem I have is the mapbook are all called the same thing e.g PDF123.tmp when I would prefer them to be called Map 1 etc. How would I go about changing this? it happens after they are exported from data driven pages –  sni Mar 1 '12 at 0:14
    
To keep the Question and Answer flow uncluttered would you be able to ask a new Question for this, please? –  PolyGeo Mar 1 '12 at 3:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.