Error:
Number of shapes does not match number of table records。
Error Message:
The following error occurs when adding a theme to a view:
“Number of shapes does not match number of table records.”
Cause:
The error happens when the number of features in the shapefile does not match the number of attributes in the DBF file. These are some common causes that produce the error.
- adding or deleting records to the DBF file corresponding to the existing shapefile
- a system failure occurs during the edit process and the shapefile is saved in a corrupted state
- multiple users editing the same shapefile
- adding features to a theme and the user double-clicks the mouse. A record with zero area is added to the table, but the feature may not bevisible in the view.
Solution or Workaround:
The shapefile may be recovered with one of the following methods. It is highly recommended that a backup copy is made of the shapefile before attempting to use any of these methods.
Use Andrew Williamson’s ShapeFile Repairer Utility. Click the link to this ArcScript in Related Information.
Edit the DBF file:
- Open the DBF file.
- Delete the last record.
- Close and save the DBF file.
- Load the shapefile into your View.
Use the ArcInfo Workstation SHAPEARC command:
- Run the SHAPEARC command on the shapefile.
- Run DESCRIBE on the output coverage.
- Make note of the number of shapes.
- Open the DBF corresponding to the shapefile.
- Compare the number of records of the DBF to the number shapes resulting from the DESCRIBE command.
- If the number of DBF records is more than the number of shapes, delete records until the number of shapes matches the number of records.
- If the number of DBF records is less than the number of shapes, add records until the number of shapes matches the number of records.
- Save the DBF file.
The shapefile should open in ArcView, but there is no guarantee that attribute information for the shapefile will be correct. To test if the attribute data is assigned to the correct feature, do the following:
- Load the shapefile into a new view.
- Open the attribute table for the shapefile.
- Tile the view and the table.
- Select a record.
- Compare the selected record with the selected feature in the view.
- If the feature does not correspond with the attribute, determine whether and where to add or delete records. The DBF needs to be edited appropriately, keeping in mind that the number of records must equal the number of shapes.
Repeat the comparison steps until the features and attributes are synchronized.