# Get ArcGIS Pro to show which feature is causing copy/paste to fail

I have an Enterprise geodatabase feature class in a feature dataset that I need to copy over to a gdb. I've tried

• right click to copy and paste,
• the copy tool in ArcGIS Pro,
• copy management in ArcPy.

All raise the same error:

SG_POLYGON_HAS_VERTICAL_LINE (-2033) Polygon shell contains a vertical line

I'm having trouble tracking down, which feature is causing the error so I can fix it. It's an Oracle db and I've tried to run validate geom with context and got no results that stand out. None of the features are 3D and the feature class does not store z values.

I have no idea how this feature made it into the db to begin with. All features are loaded to the db using copy paste so I would think this would have been caught then, but alas it did not and I am at a loss.

I'm wondering if anyone knows a way to get the tool to print the name of the feature it's trying to copy so I can get a hint of where to look.

EDIT: Wanted to add that I have tried to use the export tools as well. They run without error, but less than half of the features end up being exported to the new geodatabase.

You could try using an InsertCursor and listing any errors. The following example can be run in Pro's python window (change the feature class paths obviously):

import arcpy

in_featureclass = r'path\to\connection.sde\schema.featureclass'
out_featureclass = r'path\to\filegeodatabase.gdb\featureclass'

# Make an empty copy of in_featureclass
arcpy.management.MakeFeatureLayer(in_featureclass, 'lyr', 'OBJECTID = -1')
arcpy.management.CopyFeatures('lyr', out_featureclass)

# Get the field list, excluding system fields
exclude = ['OBJECTID', 'SHAPE', 'SHAPE.AREA', 'SHAPE.LEN']
fields = [f.name for f in arcpy.da.Describe(in_featureclass)['fields'] if f.name not in exclude]

# Copy records, print the OBJECTD of any that can't be copied
with arcpy.da.SearchCursor(in_featureclass, ['OID@', 'SHAPE@'] + fields) as inrows, arcpy.da.InsertCursor(out_featureclass, ['SHAPE@'] + fields) as outrows:
for row in inrows:
try:
outrows.insertRow(row[1:])
except:
print(f'Unable to insert OID {row[0]}')


• Thanks for the response. I tried the code as suggested and it ran without returning any errors. However, only about 90,000 out of over 200,000 features were copied to the new feature class. I've had similar results using the export tools, which may use a similar process to move features as the code above and essentially skips certain problem features silently. It is concerning that so many are being skipped.
– Ryan
Sep 8 '20 at 13:07