Green_polygon1.zip (74.0 KB)
I’ve attached a shape file that was sent to me for not loading correctly. The logic that loads these shape files is unchanged for quite some time, and works fine on thousands of others in a released product, but now fails on several files from this set. The attached zip contains one of those files. Opening it in SAGA GIS shows what appears to be a valid polygon file. Our logic is as follows using a ShapeFileFeatureLayer instance.
.
mapLayer.Open( );
try
{
features = mapLayer.QueryTools.GetAllFeatures( ReturningColumnsType.AllColumns );
validation = mapLayer.Validate( );
}
catch( Exception ex )
{
exceptionMessage = ex.ToString( );
// for future reference, the “validation” dictionary contains info about exactly what was bad.
validation = mapLayer.Validate( );
}
This code throws the following exception at the GetAllFeatures line.
System.IO.FileLoadException: The record is invalid, please call Validate method to check the failed reason.Record index: 20
at ThinkGeo.MapSuite.Core.ShapeFile.mhY=(Int32 recordIndex)
at ThinkGeo.MapSuite.Core.ShapeFileFeatureSource.GetAllFeaturesCore(IEnumerable1 returningColumnNames) at ThinkGeo.MapSuite.Core.FeatureSource.<GetAllFeatures>b__175_0(IEnumerable
1 cns)
at ThinkGeo.MapSuite.Core.FeatureSource.YxY=(IEnumerable1 returningColumnNames, Func
2 getFeatures, IEnumerable1 filters) at ThinkGeo.MapSuite.Core.FeatureSource.GetAllFeatures(IEnumerable
1 returningColumnNames)
at ThinkGeo.MapSuite.Core.FeatureSource.GetAllFeatures(ReturningColumnsType returningColumnNamesType)
at ThinkGeo.MapSuite.Core.QueryTools.GetAllFeatures(ReturningColumnsType returningColumnNamesType)
The call to Validate inside the exception handler returns an empty collection, the same result I get on all the successful files after a successful call to GetAllFeatures…
Can you tell me why this shape file is not loading and displaying properly?