I would like to loop through the shapes in the attribute table and create a new intersection point feature class for each row in the table. But every time I do this, I keep on getting the same error.

Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\analysis.py", line 289, in Intersect
raise e
ValueError: DescribeGeometry: Unexpected error

This is the portion of the code I am working on, where tribufline and water_feature are line feature class. I t would be really helpful is someone is able to point me in the right direction because I have no idea what is causing this error

for row in arcpy.da.SearchCursor(tribufline, ["SHAPE@", "OID@"]):
   line = row[0]
   culint = "triculint{0}".format(row[1])
   arcpy.Intersect_analysis([line, water_feature], culint, "ALL", "","POINT")
  • Why go through each row if you can do them all in one go with a tool? – FelixIP Aug 31 '16 at 2:56

You mention that water_feature is a Feature Class, but in the arcpy.Intersect_analysis you are using a geometry (line) with a feature class (water_feature). I'm not sure which is right, but I would think they should both be geometries or they should both be feature classes.

  • I think you are right that there may be a mismatch trying to do a line-on-line overlay between something that is just a geometry and something that has attributes. – PolyGeo Aug 30 '16 at 20:49

I think you should start by adding a print statement to see which particular OID this is erroring on.

However, there are a few other things that I think you could do to improve your code snippet for testing:

import arcpy
tribufline = ???
water_feature = ???
with arcpy.da.SearchCursor(tribufline, ["SHAPE@", "OID@"]) as cursor:
    for row in cursor:
        print "Processing OID: {0}".format(row[1])
        line = row[0]
        culint = "triculint{0}".format(row[1])
        arcpy.Intersect_analysis([line, water_feature], culint, "ALL", "","POINT")

The output from the code snippet above should be more informative than what you have posted.

  • I assume you copy/pasted the 'for row...' line, but it may as well be 'for row in cursor:' since you already built the cursor in the previous line. – phloem Aug 30 '16 at 20:43
  • @phloem You're right - thanks! And I had forgotten to include the print statement that I intended. – PolyGeo Aug 30 '16 at 20:44

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.