This project is read-only.

ShapeFile.NumShapes returns incorrect value

Aug 8, 2013 at 9:01 PM
Another odd behavior - a shapefile that displays in the MapWin viewport returns 1 when the property Shapefile.NumShapes is accessed. Needless to say, it has more than 1 polygon. However, another shapefile that only has 2 polygons returns the correct number, which in this case was 2.

Is there a limitation in the Shapefile class where it cannot handle multipart geometries? This may account for much of the bizarre, nonfunctioning behavior that I have been experiencing.
Aug 8, 2013 at 9:22 PM
Ok....I just did a test and I verified that it is a multipart geometry problem.

The Shapefile class is providing the correct number of shapes. In this particular case, it is one feature (shape) that consists of 870 parts, each part being a little polygon. So, the geoprocessing functions do not work correctly on multipart geometries. I verified this by converting the multipart shapefile into a single part shapefile. Voila!, the Shapefile.Clip method works correctly and the Shapefile.NumShapes gives the correct number of single parts.

This is what I was trying to determine from the beginning with my initial question: "Do the geoprocessing functions have any limitations?"

Please....from now on answer with, "YES - IT CANNOT HANDLE MULTI-PART GEOMETRIES"