TransWikia.com

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

Geographic Information Systems Asked on January 26, 2021

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.

One Answer

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'pathtoconnection.sdeschema.featureclass'
out_featureclass = r'pathtofilegeodatabase.gdbfeatureclass'

# 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]}')
    

Answered by user2856 on January 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP