Friday, 4 May 2018

arcgis desktop - Do Data Driven Pages enable PDF merging without losing layers?


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.



Answer



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?


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...