ThinkGeo.com    |     Documentation    |     Premium Support

Errors with a shape file and 'CheckForUnsupportedRecords'

I'm trying to load a customer's shape file and keep getting this error...


"The record is invalid, please call CheckForUnsupportedRecords method to check the the failed reason.Record index: 100345"


I tried searching for the method metioned above in all of the API docs and code and couldnt find anything called that.   What does this error mean and how can i fix it?


Thanks, Chad



Chad, 
  
 What you need is to call the ShapeFileFeatureLayer.Validate() method to check if any records has some problem. We used to name it “CheckForUnsupportedRecords” and updated it to Validate() later, apparently we forgot to update the corresponding exception description. We will change that exception in the next release and sorry for the inconvenience now. 
  
 Here is the code should be 
 
           ShapeFileFeatureLayer shapeFileFeatureLayer = new ShapeFileFeatureLayer("mydata.shp");
            shapeFileFeatureLayer.Open();
            shapeFileFeatureLayer.Validate();
            shapeFileFeatureLayer.Close();
 
 Thanks, 
  
 Ben 


Ok that got me to the next step.  Now what i find is that 12 results come back, they are all the same problem..


XXXXXX (different #'s here), The record content is not valid.


I open the corresponding dbf file in MS Excel and dont see anything with those numbers on them?  Would it be easier if i sent you the shp file for you to look at?


THanks,


Chad



Chad, 


I think something wrong with your binary .shp file and yes it will be much easier if you can send the shape file (.shp .dbf and .shx) to us. Please send it to support@thinkgeo.com and ask to forward to Ben. If it is too big to send in a mail, please contact support@thinkgeo.com and we may provide some FTP for you to upload. Also you can setup a file server so I can download, that’s another way.
 
Thanks,
 
Ben

Chad, 
  
 I got your file and I found those records are polygons without any rings inside, kind of "blank" records. We will have more investigation on it and will let you know more when we get it finished. 
  
 Ben

thanks, i'll look forward to hearing back from you on the problem. - Chad



Chad, 
  
 After further investigation, I found you can work it around by generating the index file first. Drag and drop that shape file to MapSuite Explorer and it will prompt up a message asking whether you want to build the index, click yes and Bang, it works. Also, I have added this issue to our tracking system so in next version we can totally support your shape file without having to build the index files (although we always recommend you to build the index first). 
  
 Thanks, 
  
 Ben 
  
   


Thanks for the responses, just got a chance to take a look at it and building an Index file did allow me to display it however i still get other errors when actually trying to query the layer.  A simple example that will give you an error with that layer:



Collection



<Feature> features = layer.FeatureSource.GetAllFeatures( new string[] { "ppn" } );

 




Chad,


The GetAllFeatures() method will skip checking the index and that’s why it cannot go around those “illegal” records. Anyway, I modified your shape file and uploaded the correct one to the same folder of your original data, please get it and have another try.


Thanks,


Ben.