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 <SPAN style="color: #303030;"><SPAN style="font-family: arial black,avant garde;"><SPAN class="n">arcpy</SPAN><SPAN class="o">.</SPAN><SPAN class="n">mapping</SPAN><SPAN class="o">.</SPAN><SPAN class="n">ListLayoutElements but i am not sure if arcpy can create new features like the north arrow, scale bar and text. If so how?</SPAN></SPAN><SPAN class="p"></SPAN></SPAN>
The current code creates a pdf of the selected parcel. I noticed that if i add "df" to the {data_frame} in <SPAN style="color: #303030; font-family: arial black,avant garde;"><SPAN class="n">arcpy</SPAN><SPAN class="o">.</SPAN><SPAN class="n">mapping</SPAN><SPAN class="o">.</SPAN></SPAN><SPAN style="color: #303030; font-family: arial black,avant garde;"><SPAN class="n">ListLayoutElem</SPAN></SPAN><SPAN style="color: #303030; font-family: arial black,avant garde;"><SPAN class="n">ents 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?</SPAN></SPAN>
<SPAN style="color: #303030; font-family: arial black,avant garde;"><SPAN class="n"> if i removed the "df". it will defult to PAGE_LAYOUT.</SPAN></SPAN>
code
import arcpy, os
import arcpy.mapping
from arcpy import env
# Set workspace
arcpy.env.workspace = "C:/Temp"
arcpy.env.overwriteOutput = 'True'
env.qualifiedFieldNames = False
directory="C:/Temp/Split.pdf"
if os.path.exists(directory):
try:
os.remove(directory)
except:
print "Exception: ",str(sys.exc_info())
else:
print 'File not found at ',directory
#deletes the geodatabase prior if it exists
try:
if arcpy.Exists("C:/temp/NewFeatures.shp"):
arcpy.Delete_management("C:/temp/NewFeatures.shp")
except:
pass
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
arcpy.RefreshActiveView()
arcpy.mapping.ExportToPDF(mxd,"C:/Temp/Split.pdf",df)