Annotation feature classes in personal geodatabases need to be added to mxds. The annotation is not already in the mxd. I tried Make Feature Layer and add layer through arcpy.mapping and it did not work. Esri states that complex features such as annotation are not supported.
Do I have to open 88 mxds and drag in the annotation feature classes?
1 Answer 1
I'm not sure what you tried and researched but I just ran the test below using ArcGIS 10.2.2 for Desktop and the annotation feature class from a personal geodatabase (*.mdb) was added to my map using ArcPy.
import arcpy
# C:\temp\test.mxd is a blank map
mxd = arcpy.mapping.MapDocument(r"C:\temp\test.mxd")
df = arcpy.mapping.ListDataFrames(mxd)[0]
arcpy.MakeFeatureLayer_management(r"C:\temp\test.mdb\AnnoFC","annoFL")
annoLayer = arcpy.mapping.Layer("annoFL")
arcpy.mapping.AddLayer(df,annoLayer)
mxd.save()
To give credit where it's due my quick research uncovered the basis of the above coding pattern in a GeoNet thread.
-
Huh. How about that. I had the exact same problem where it was adding the annotion as a polygon fc. Works just fine in 10.0. Awesome, thanks!dubch87– dubch872014年09月19日 17:05:12 +00:00Commented Sep 19, 2014 at 17:05