I am hoping you can shed some light on this error message I got. It happens when I am trying to to use ShapeFileFeatureLayer.BuildIndexFile() on my shapefile. I am not sure what it could be. I ran it through ArcMap’s Check & Repair Geometry a few times, and it did not find issues but also cannot draw the shapefile properly. So, something went wrong somewhere with it. I wanted to try to narrow down the possibilities.
The one thing I can think of that may cause an issue with it was I deleted a feature from the shapefile. When I deleted, I did this:
parentShapefile.ReadWriteMode = ShapeFileReadWriteMode.ReadWrite
parentShapefile.Open()
parentShapefile.FeatureSource.Open()
parentShapefile.FeatureSource.BeginTransaction()
parentShapefile.FeatureSource.DeleteFeature(selectedFeature.Id)
parentShapefile.FeatureSource.CommitTransaction()
parentShapefile.FeatureSource.Close()
ShapeFileFeatureSource.BuildIndexFile(parentShapefile.ShapePathFileName)
Since that is the one thing I can think of that may cause the issue, I wanted to confirm I had the appropriate process down for removing features from a shapefile. I have the shapefile attached, and I am using version 8.0.
I have seen some other people mention this issue and one proposed solution back in I believe the 6.0 era was to override those methods that get the features (GetAllFeatures, GetFeaturesByID, etc…) and prior to returning the features, validate and repair each feature. Is that the better option or is there also a way to repair shapefiles if they need it?
Here is the stack trace for my error:
at ThinkGeo.MapSuite.Core.BaseShape.CreateShapeFromWellKnownData(Byte[] wellKnownBinary)
at ThinkGeo.MapSuite.Core.ShapeFileFeatureSource.BuildIndexFile(String shapePathFilename, String indexPathFilename, Projection projection, String columnName, String regularExpression, BuildIndexMode buildIndexMode, Encoding encoding)
at ThinkGeo.MapSuite.Core.ShapeFileFeatureSource.BuildIndexFile(String shapePathFilename, String indexPathFilename, Projection projection, String columnName, String regularExpression, BuildIndexMode buildIndexMode)
at ThinkGeo.MapSuite.Core.ShapeFileFeatureSource.BuildIndexFile(String shapePathFilename, BuildIndexMode buildIndexMode)
layer1.zip (2.93 KB)