Note: This article pertains to ArcGIS versions 9.x. Later versions of ArcGIS may contain different functionality, as well as different names and locations for menus, commands and geoprocessing tools.
When creating a new feature through either the CreateFeature and Store method, or the use of an InsertCursor, the creation fails with the following error:
FDO_E_INVALID_GRID_SIZE -2147216894 The spatial index grid size is invalid.
The FDO_E_INVALID_GRID_SIZE error is raised because the grid size of the feature class where the feature is created is too small to manage the feature. This error only occurs with File or ArcSDE Geodatabases.
Depending on when the error message is raised, there are two ways to manage it.
'Place the feature class in loadonly mode. This step must be done before calling IFeature.Store or IFeatureCuror.InsertCursor Dim pFCLoad As IFeatureClassLoad Set pFCLoad = pFeatureClass pFCLoad.LoadOnlyMode = True 'Create feature buffer Dim pFeatBuffer As IFeatureBuffer Set pFeatBuffer = pFeatureClass.CreateFeatureBuffer Set pFeatBuffer.Shape = pGeometry 'Create insert cursor and insert buffer Dim pCursor As IFeatureCursor Set pCursor = pFeatureClass.Insert(True) 'Insert the feature and call flush pCursor.InsertFeature pFeatBuffer pCursor.Flush 'Take the feature class out of loadonly mode, and the Geodatabase calculates an appropriate grid size based on the features in the feature class pFCLoad.LoadOnlyMode = False