1

I am writing a script that checks the geometry of all point, lines and polygons in a gdb. I used a script provided by Esri and it works fine, however it only returns the name of the featureclass, object Id and problem.

I would also like it to return a specific attribute of each feature with a geometry problem; Namely "PUIcode"

I used the following script:

# The geodatabase in which the feature classes will be checked
source_gdb = r"C:\Users\deboerr7373\Documents\assets.gdb"
outTable = "checkGeometryResult"

# A variable that will hold the list of all the feature classes 
# inside the geodatabase
def listFcsInGDB(gdb):  
    ''' list all Feature Classes in a geodatabase, including inside Feature Datasets ''' 
    arcpy.env.workspace = source_gdb  
    fcs = []  
    for fds in arcpy.ListDatasets('','feature') + ['']:  
        for fc in arcpy.ListFeatureClasses('', 'point' or 'line' or 'polygon' ,fds):  
            fcs.append(os.path.join(fds, fc))  
    return fcs  

fcs = listFcsInGDB(source_gdb)

print("Running the check geometry tool on {} feature classes".format(len(fcs)))
arcpy.CheckGeometry_management(fcs, outTable)

print("{} geometry problems found, see {} for details.".format(arcpy.GetCount_management(outTable)[0],
                                                               outTable))

And I got the following results "CheckGeometryResult": enter image description here

However What I would like to have: enter image description here

The data in my bdg are point/line/polygon feature classes and have the following attributes: enter image description here

Has anyone any idea how to solve this problem? I considered joining tables afterwards, however the CheckGeometryResult table contains objects id's that come from different features classes. So I would than have to join on the combination of featureclass name and object Id. But I could only find the option of joining on only object Id.

1

I think this is a simple case of running your code in a different order.

Run the check geometry individually rather than supplying a list of featureclasses to test. This way you can join the PUICode to the output table on each run.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.