Skip to main content

i have a table i intend to copy and setup in various places and it would be helpful if i could generate the creation script in python (for arcgis) for that table

i.e.

try:

FeatureClassLabel = "NeighborhoodCommunityBoundary"

FeatureClassName = arcpy.env.workspace + "\\" + FeatureClassLabel

arcpy.CreateFeatureclass_management(arcpy.env.workspace, FeatureClassLabel, "POLYGON", "", "DISABLED", "DISABLED", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119522E-09;0.001;0.001;IsHighPrecision", "", "0", "0", "0")

print

print ("Created Feature Class:     " + FeatureClassName)

print ("Adding Fields to Feature Class: " + FeatureClassName)

arcpy.gp.AddField(FeatureClassName, "DiscrpAgID", "TEXT", "", "", "75", "Discrepancy Agency ID", "NON_NULLABLE", "REQUIRED", "")

arcpy.gp.AddField(FeatureClassName, "DateUpdate", "DATE", "", "", "", "Date Updated", "NON_NULLABLE", "REQUIRED", "")

arcpy.gp.AddField(FeatureClassName, "Effective", "DATE", "", "", "", "Effective Date", "NULLABLE", "NON_REQUIRED", "")

arcpy.gp.AddField(FeatureClassName, "Expire", "DATE", "", "", "", "Expiration Date", "NULLABLE", "NON_REQUIRED", "")

arcpy.gp.AddField(FeatureClassName, "NbrhdNGUID", "TEXT", "", "", "254", "Neighborhood NENA Globally Unique ID", "NON_NULLABLE", "REQUIRED", "")

arcpy.gp.AddField(FeatureClassName, "Country", "TEXT", "", "", "2", "Country", "NON_NULLABLE", "REQUIRED", "Country")

arcpy.gp.AddField(FeatureClassName, "State", "TEXT", "", "", "2", "State", "NON_NULLABLE", "REQUIRED", "State")

arcpy.gp.AddField(FeatureClassName, "County", "TEXT", "", "", "75", "County", "NON_NULLABLE", "REQUIRED", "County")

arcpy.gp.AddField(FeatureClassName, "AddCode", "TEXT", "", "", "6", "Additional Code", "NULLABLE", "NON_REQUIRED", "")

arcpy.gp.AddField(FeatureClassName, "Inc_Muni", "TEXT", "", "", "100", "Incorporated Municipality", "NON_NULLABLE", "REQUIRED", "")

arcpy.gp.AddField(FeatureClassName, "Uninc_Comm", "TEXT", "", "", "100", "Unincorporated Community", "NULLABLE", "NON_REQUIRED", "")

arcpy.gp.AddField(FeatureClassName, "Nbrhd_Comm", "TEXT", "", "", "100", "Neighborhood Community", "NON_NULLABLE", "REQUIRED", "")

#arcpy.ImportMetadata_conversion(MetadataPath + FeatureClassLabel + ".xml", "FROM_ISO_19139", FeatureClassName, "ENABLED")

# Enable Editor Tracking in UTC.

arcpy.EnableEditorTracking_management(FeatureClassName, "", "", "", "DateUpdate", "NO_ADD_FIELDS", "UTC")

except Exception:

e = sys.exc_info()n1]

print(e.args.0])

OpenArchived