0

I want to unify my gdb's, and later the layers in the mxd. I ran the following script successfully, but some of my layers are not the same as the template ones. Annotation Feature classes are not created. Why doesn't this tool create Annotation Feature Classes?

import arcpy, os, sys
#list of my desired FCs in a gdb
fcList = ['FC1', 'FC2', 'FC3']
gdb = "D:\\scripttest\\fillup\\test.gdb"
spatial_reference = arcpy.Describe("D:\\scripttest\\fillup\\test.gdb\\FC").spatialReference
has_m = "DISABLED"
has_z = "DISABLED"
workspace = "D:\\scripttest\\fillup"
for fcName in fcList:
 arcpy.env.workspace = gdb
 if not arcpy.Exists(fcName):
 #Searching for a template feature class in a folder to copy it's structure and appending it to fc[]
 fc = []
 while len(fc)<1:
 for dirpath, dirnames, filenames in arcpy.da.Walk(workspace, datatype="FeatureClass"):
 for fname in filenames:
 if fname == fcName:
 fc.append(os.path.join(dirpath, fcName))
 print fcName + " creating"
 template = fc[0]
 print ("temp: "+ template)
 #getting the geometry_type from the template
 desc = arcpy.Describe(template)
 geometry_type = desc.shapeType
 arcpy.CreateFeatureclass_management(gdb, fcName, geometry_type, template, has_m, has_z, spatial_reference)
 print (fcName + " created")
 del fc[:]
KHibma
17.1k1 gold badge34 silver badges57 bronze badges
asked Mar 4, 2020 at 14:40
1
  • Have a look at this Q&A? Commented Mar 4, 2020 at 14:59

1 Answer 1

1

From the tool help for Feature Class to Feature Class, the geometry type of the output featureclass to be created is listed with the following options:

POINT —Point

MULTIPATCH —Multipatch

MULTIPOINT —Multipoint

POLYGON —Polygon

POLYLINE —Polyline

Despite the help not specifically mentioning annotation featureclasses, I'd suspect based on the above list, these are the only types you could create.

You may need to enhance the code to identify Annotation Featureclasses and make use of another tool, like Append Annotation Feature Class

answered Mar 4, 2020 at 17:09
1
  • ArcObject's 'IAnnotateLayerPropertiesCollection' Interface could help me only. But I have bad memories with vb.net, so i rather solve my problem with creating a template geodatabase by copying the missing feature classes, and with arcpy.DeleteFeatures_management() , i delete every row, so i can copy these fcs to every gdb. Commented Mar 5, 2020 at 15:17

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.