Labeling Symbols vs Symbology - Scripting

1651
0
09-19-2012 12:14 PM
GavinMayeda
Occasional Contributor II
We are in the process of automating the output of our map pages.  Several questions and issues have come up along the way that we are hoping to find some answers to.
We are currently using Labeling to create our annotation and symbols on our map page. (see attached example) The shown labeling was set up manually, and saved as layer files for the respective labeling.  Is there a script that would automate that process and have the labels look exactly as they are shown? Below is an example of the script being used:

#Setup database to work with
arcpy.env.workspace = "Database Connections/gis_inquire.sde/AS.Parcels"

# Create Feature Layer - all areas
base_layer = arcpy.MakeFeatureLayer_management("ASSESSORS.ParcelsWO")

# From Feature Layer, select by criteria
parcel_selection = arcpy.SelectLayerByAttribute_management(base_layer,"NEW_SELECTION","BOOK_PAGE LIKE '12345%'")

# Save parcels feature layer to disk as a .lyr file
arcpy.SaveToLayerFile_management(parcels_layer, "F:/Documents/Project Docs/GIS/ParcelLayer.lyr")

# Read existing mxd file (template)
mxd = arcpy.mapping.MapDocument("F:/Documents/Project Docs/GIS/MAP_TEMPLATE.mxd")

# Get access to template's only data frame
df = arcpy.mapping.ListDataFrames(mxd)[0]

# Read feature layers from disk
parcellayer = arcpy.mapping.Layer(r"F:/Documents/Project Docs/GIS/ParcelLayer.lyr")

# Add my feature layers to existing template
arcpy.mapping.AddLayer(df, parcellayer, "BOTTOM")

# apply known layer attributes to new layer (APN Markers and 1PT parcel border)
# ExportStyleLayer.lyr created from ArcMap existing map using "Save as Layer File..." - hoping to get font styles from here
updateLayer = arcpy.mapping.ListLayers(mxd, parcellayer.name, df)[0]
sourceLayer = arcpy.mapping.Layer(r"F:/Documents/Project Docs/GIS/ExportStyleLayer.lyr") # a layer that represents look/labels etc that we want.
arcpy.mapping.UpdateLayer(df, updateLayer, sourceLayer, False) # OnlySymbology=False (want all attributes of the known layer)

# change datasource?
#updateLayer.replaceDataSource(?, ?, ?)

The process of using the symbology vs labeling was brought up, is there a preferred/better way to do this?

Any insight or help is always appreciated.
0 Kudos
0 Replies