blankblank blank




Fixing "Broken" Shapefiles



Ever get an error message when opening a shapefile like, “Number of shapes does not match number of table records”? Yeah, well, neither have I. But if you ever do have such a problem, the Shape Checker utility might be able to rescue at least some, if not most of your data. It can re-generate a new .shx index file for your .shp file, add or delete lines to the .dbf file to match the number of shapes, and if your DBF file is totally hosed, can recreate a blank DBF for that shapefile. Not great, since you’ll lose whatever data you had in that datafile, but better than losing everything.

As the web page suggests, it’s probably best to do this on a copy of the corrupted file, rather than the original itself. Run the program:

shapechecker

Select the problematic .shp file with the left button, then recreate the .shx file with the “Build Shx” button. You can then check the DBF file for the proper number of records with the Check DBF button; if there are problems, or if the DBF file is missing, you’ll be given the option to fix it or create a blank one from scratch. I’ve tried it on point, line and polygon shapefiles I screwed up deliberately, and it worked as advertised. The program hasn’t been updated since 1999, but the author also provides the Delphi source code if you want to modify it yourself.

Other posts in the GIS Tools series

  1. Converting E00 Vector Data To Shapefiles - A Free And Fairly Painless Approach
  2. Simplifying Line And Polygon Shapefiles
  3. Converting US Census TIGER Data Into Shapefiles For Free
  4. Converting Shapefiles and ArcINFO Coverages To AutoCAD DXF Format
  5. Converting Point Shapefiles To Text/Spreadsheet Format
  6. Converting Text/Spreadsheet Files To Point Shapefile Format
  7. An Easier Way To Convert Shapefiles to Text/Spreadsheet Format
  8. Converting Text/Spreadsheet Data To Line/Area Shapefiles
  9. Full Resolution Raster Map Combining, Subsetting And Export With The TatukGIS Viewer
  10. Viewing Vector Data In The TatukGIS Viewer
  11. The LizardTech Stand-Alone MRSID Viewer
  12. Converting Raster Area Images Into Polygon Shapefiles
  13. SAGA GIS 2.0 Released
  14. ILWIS GIS Is Now Open Source
  15. AVHRR Analysis Add-On For ILWIS
  16. Advanced Image Mosaicking With Regeemy
  17. A Free GIS Viewer (And Cheap GIS Editor) For Windows Mobile Systems
  18. Updates For MapWindow And Saga GIS Programs
  19. Updates For Two Open-Source GIS Programs
  20. Putting Together A Basic Linux GIS Workstation
  21. Free Online Courses For Open Source GIS
  22. GIS-Oriented Linux Distributions
  23. Tabular Terrain Elevation Data
  24. Quick Data Gridding With QuikGrid
  25. A Good Introduction To Geospatial Data Analysis
  26. Converting Digital Elevation Models To Shapefile/DXF Contours
  27. Fixing "Broken" Shapefiles
  28. A Simple DBF Editor
  29. Two Online Vector GIS/GPS/KML Conversion Utilities
  30. Another Shapefile Repair Tool
  31. Quantum GIS (qGIS) Version 0.10 Released
  32. Online Raster Map Georeferencing/Registration With Map Rectifier
  33. Using The Demo Version Of Global Mapper As A Raster/Vector Data Viewer
  34. New Stable Release Of MapWindow GIS
  35. The Big List Of Free Metadata Software I
  36. The Big List Of Free Metadata Software II
  37. GIS On A Stick
  38. ILWIS 3.5 Released


Subscribe to this blog's RSS feed

1 Response to “Fixing "Broken" Shapefiles”


  1. 1 Simon Jackson

    saved me a number of times. I found the main cause was editing shapefiles over slow network connections.

    http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&d=17791

Leave a Reply


Be sure to enter the "reCAPTCHA" below before submitting your comment.