how could I do the following steps with arcpy:
- right-click on the layer with the features
- Label Features
- Convert Labels to Annotations ...
The annotions should be saved in a new shapefile.
How could I do this in python?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityhow could I do the following steps with arcpy:
The annotions should be saved in a new shapefile.
How could I do this in python?
You can use the Tiled Labels To Annotation Geoprocessing tool.
import arcpy
# Settings
scale = "30000"
folder = "D:\Temp\LBL.gdb"
arcpy.env.workspace = folder
# Mapdocument
map = r"D:\Temp\MAP-LBL.mxd"
# Local variables:
dataFrame = "Layer"
grid = "Grid"
group = "Group"
suffix = "Anno"
fid = "tile"
link = "STANDARD" # not linked = "STANDARD" / linked = "FEATURE_LINKED"
unplace = "GENERATE_UNPLACED_ANNOTATION"
# Process: Tiled Labels To Annotation
arcpy.TiledLabelsToAnnotation_cartography(map, dataFrame, grid, folder, group, suffix, scale, "", fid, "", "", link, unplace)
Below is a similar question to yours that was answered on this site.
Creating labels based on attribute field in shapefile with Arcpy?
You can enable labels through use of the LabelClass class in arcpy's mapping module, but I am not aware of a method for creating annotations in python. Hopefully this will be added as ESRI continues to improve arcpy functionality and integration.