Skip to main content
edited tags
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
Notice removed Improve details by Aaron
Bounty Ended with Chad Cooper's answer chosen by Aaron
Tweeted twitter.com/#!/StackGIS/status/352444473260777473
Notice added Improve details by Aaron
Bounty Started worth 50 reputation by Aaron
Added more detail
Source Link
Aaron
  • 51.8k
  • 29
  • 157
  • 321

I have a handful of approximately 1000 shapefiles that are corrupted (see attached error message). The shapefiles were generated from eCognition Developer 8. There is a script tool that seems to repair the shapefile once it is identified as corrupted.

Whatenter image description here

Edit:

I want to create a quick script to loop through all of my shapefiles and check if the number of shapes matches the table records. I can count table records using the following:

# Name: fcCount.py
# Purpose: calculate the number of features in a featureclass

# Import system modules
import arcpy
from arcpy import env

env.workspace = "C:/data"
Sample = "MyShp.shp"
result_dbf = int(arcpy.GetCount_management(Sample).getOutput(0)) 
print result_dbf

I would ultimately like to create some sort of logic check such as:

if result_dbf = result_shp:
    pass
else:
    print "There is a problem with" + str(Sample)

How can I count shapes directly without accessing the .dbf file? Or, in other words, what is the best way to programmatically check if the number of shapes matches the number of table records?

enter image description here

I have a handful of approximately 1000 shapefiles that are corrupted (see attached error message). The shapefiles were generated from eCognition Developer 8. There is a script tool that seems to repair the shapefile once it is identified as corrupted.

What is the best way to programmatically check if the number of shapes matches the number of table records?

enter image description here

I have a handful of approximately 1000 shapefiles that are corrupted (see attached error message). The shapefiles were generated from eCognition Developer 8. There is a script tool that seems to repair the shapefile once it is identified as corrupted.

enter image description here

Edit:

I want to create a quick script to loop through all of my shapefiles and check if the number of shapes matches the table records. I can count table records using the following:

# Name: fcCount.py
# Purpose: calculate the number of features in a featureclass

# Import system modules
import arcpy
from arcpy import env

env.workspace = "C:/data"
Sample = "MyShp.shp"
result_dbf = int(arcpy.GetCount_management(Sample).getOutput(0)) 
print result_dbf

I would ultimately like to create some sort of logic check such as:

if result_dbf = result_shp:
    pass
else:
    print "There is a problem with" + str(Sample)

How can I count shapes directly without accessing the .dbf file? Or, in other words, what is the best way to programmatically check if the number of shapes matches the number of table records?

Fixed error
Source Link
Aaron
  • 51.8k
  • 29
  • 157
  • 321

I have a handful of approximately 1000 shapefiles that are corrupted (see attached error message). The shapefiles were generated from eCognition Developer 8. The problem occurs when ArcGis 10.1 creates the .sbn file. When this file is deleted, the error message goes away and the file can be viewed. There is a script tool that seems to repair the shapefile once it is identified as corrupted.

What is the best way to programmatically check if the number of shapes matches the number of table records?

enter image description here

I have a handful of approximately 1000 shapefiles that are corrupted (see attached error message). The shapefiles were generated from eCognition Developer 8. The problem occurs when ArcGis 10.1 creates the .sbn file. When this file is deleted, the error message goes away and the file can be viewed. There is a script tool that seems to repair the shapefile once it is identified as corrupted.

What is the best way to programmatically check if the number of shapes matches the number of table records?

enter image description here

I have a handful of approximately 1000 shapefiles that are corrupted (see attached error message). The shapefiles were generated from eCognition Developer 8. There is a script tool that seems to repair the shapefile once it is identified as corrupted.

What is the best way to programmatically check if the number of shapes matches the number of table records?

enter image description here

Source Link
Aaron
  • 51.8k
  • 29
  • 157
  • 321
Loading