Geometry is broken after running Python script

282
4
Jump to solution
05-22-2021 06:14 AM
Rivers10
New Contributor

Hi all

I'm using ArcGIS Desktop10.6. I created Python script to process data, but I can't see any polygon after running the script. There is no error during the process and updated table is attached properly.

I run 'Check Geometry' tool and it returns "bad dataset extent".

I run 'Add Spatial Index' tool, but  Error999999 shows up.

Can you help me what is wrong with my script?

arcpy.AddField_management(OutFC, "FBreak", 'TEXT', "", "", 20, "", "NULLABLE")

with arcpy.da.UpdateCursor(OutFC, ["SHAPE@","FBreak"]) as cursor:
   for row in cursor:
      Buff20 = arcpy.Buffer_analysis(row[0], arcpy.Geometry(), "20 meters")
      CFBreak = OutPut + '\\CFBreak'
      arcpy.Clip_analysis(FB, Buff20, CFBreak)
      Count = arcpy.GetCount_management(CFBreak)
      if Count == 0:
         row[1] = "None"
      elif Count >= 1:
         row[1] = "Exist"
      else:
         pass
      arcpy.Delete_management(CFBreak)
      cursor.updateRow(row)

0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

As I suggested.. if you are going to use cursors and work with geometry directly, use the geometry class in arcpy.  For example, see the Polygon class, buffer method

Polygon—ArcGIS Pro | Documentation


... sort of retired...

View solution in original post

4 Replies
DanPatterson
MVP Esteemed Contributor

Buffer and clip Analysis need to be using featureclasses

Buffer (Analysis)—ArcGIS Pro | Documentation

If you want to use cursors, use the equivalent functions in the arcpy class structure


... sort of retired...
0 Kudos
Rivers10
New Contributor

I changed Buffer part as:

Buff20 = OutPut + '\\Buff20'
arcpy.Buffer_analysis(row[0], Buff20, "20 meters", "", "", "NONE", "", "")

However, result is same. I can't see polygon..

Is there any other suggestion?

0 Kudos
DanPatterson
MVP Esteemed Contributor

As I suggested.. if you are going to use cursors and work with geometry directly, use the geometry class in arcpy.  For example, see the Polygon class, buffer method

Polygon—ArcGIS Pro | Documentation


... sort of retired...
Rivers10
New Contributor

Thanks Dan

I changed Buffer part as below, then I can see polygon and updated table!!

Buff20 = row[0].buffer(20)

 

0 Kudos