Error: InvalidShapeException: invalid shapes were detected
When adding shapefiles to Author or ArcExplorer Java Edition or creating a MapService in Administrator that uses shapefiles, the follow error message is displayed in the Message Console for Author, ArcExplorer Java Edition or Administrator:
"Jan 1, 2002 12:00:00 PM: com.esri.mo.file.shp.db
com.esri.mo.file.shp.InvalidShapeException: X invalid shape/s were detected in <servicename>
at com.esri.mo.file.shp.eb.dispose(Unknown Source)
at com.esri.mo.data.feat.BaseFilterCursor.dispose(Unknown Source)
at com.esri.mo.map.draw.BaseRenderer.draw(Unknown Source)
There are three possible reasons a shapefile can generate an InvalidShapeException error:
1. When a shape is not of the same type as the file. For instance, a point shape in a polygon file.
2. When there is a problem with the shape geometry. For instance, a polyline with a path that contains one point. Polyline paths must contain at least two points. Another example is a polygon whose ring does not have at least three points. Polygon rings must close and, therefore, should have at least three points.
3. When a null shape is encountered.
Solution or Workaround
Remove the invalid shapes from the shapefile.
- Start ArcCatalog.
- Create a new personal geodatabase: right-click on a folder in the Catalog tree and select New > Personal Geodatabase.
- Right-click on the personal geodatabase, select Import > Shapefile to Geodatabase
and specify the shapefile, providing a name for the output feature class.
- If the shapefile has no spatial reference information, specify a projection for the output feature class. A. In the Shapefile to Geodatabase wizard, click Change Settings.
B. In the Output Settings Window, under the Spatial Reference Tab, click Change�.
C. Click Select� to specify a projection.
D. Select the projection that pertains to the shapefile.
E. Click Add.
F. Click OK.
G. Click OK to close the Output Settings window.
If the shapefile has the correct projection, continue to Step 5.
- Click OK to run the conversion process, which creates a new feature class has under the personal geodatabase.
- Right-click on the new feature class and select Export > Geodatabase to Shapefile.
- In the dialog box, specify a name for the new shapefile. Click OK to run the conversion process.
- Close ArcCatalog.
- Start ArcMap and add the new shapefile.
- Open the attribute table for this layer.
A new field called 'Shape_Leng' has been added to the attribute table.
- Add the Editor toolbar to ArcMap, if necessary. This toolbar can be added by right-clicking on the ArcMap toolbar and checking the Editor choice.
- On the Editor toolbar, click Start Editing.
- Sort the table in ascending order of the 'Shape_Leng' field.
Features that have a length value of '0' are the invalid features in the shapefile.
- Select the invalid features and delete them. Save Edits to the shapefile and Stop Editing.
Once these features have been removed, use this new shapefile in Author, ArcExplorer Java Edition, or Administrator.