AnsweredAssumed Answered

ExportToPDF Q

Question asked by CCweedcontrol on Apr 4, 2016
Latest reply on Apr 4, 2016 by Dan_Patterson

My fellow mappers split taxparcel and part of the splitting process they have to include a pdf or jpg of the split with the new split/adjusted parcel, example attached (Split(2).png) . I am trying automate the process to make it easier for them as it currently take multiple steps to create this split print out. They currently have driven data pages set up but they don't need the layout of the driven pages they need just a basic exported map like the one i have attached with a few items, like the north arrow and scale bar and possibly initials of the mapper , as example attached (Split(2).png) . I have currently looked through arcpy.mapping.ListLayoutElements but i am not sure if arcpy can create new features like the north arrow, scale bar and text. If so how?


The current code creates a pdf of the selected parcel. I noticed that if i add "df" to the {data_frame} in arcpy.mapping.ListLayoutElements it exports the like the following attached Split_df.png. If a file, export map and chose pdf, it looks alot better then using arcpy.mapping.ExportToPDF, why is this?


if i removed the "df". it will defult to PAGE_LAYOUT.



import arcpy, os

import arcpy.mapping
from arcpy import env

# Set workspace
arcpy.env.workspace = "C:/Temp"
arcpy.env.overwriteOutput = 'True'
env.qualifiedFieldNames = False

if os.path.exists(directory):
        print "Exception: ",str(sys.exc_info())
    print 'File not found at ',directory

#deletes the geodatabase prior if it exists
    if arcpy.Exists("C:/temp/NewFeatures.shp"):

mxd = arcpy.mapping.MapDocument("current")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
lyr = arcpy.mapping.ListLayers(mxd, "DSD.DBO.TaxParcels")[0]

if int(arcpy.GetCount_management("TaxParcels").getOutput(0)) > 0:
    arcpy.FeatureClassToFeatureClass_conversion("TaxParcels", "C:/temp", "NewFeatures.shp")

#Adding Labels
layer = arcpy.mapping.ListLayers(mxd, "NewFeatures")[0] 
if layer.supports("LABELCLASSES"):
    for lblclass in layer.labelClasses:
        lblclass.className = "DXF_TEXT" 
        lblclass.expression = '"%s" & [DXF_TEXT] & VBNewLine & "AC" & " " & Round([ACRES],2)& "%s"' % ("<BOL><CLR red='140'><FNT size='12'>" , "</FNT></CLR></BOL>") #WORKS!
    lblclass.showClassLabels = True
layer.showLabels = True
df.extent = lyr.getSelectedExtent()
df.scale = 10000