Is This Content Helpful?
We're glad to know this article was helpful.
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:
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 being created is too small to handle the feature. This error only occurs with File or ArcSDE Geodatabases.
Depending on how the error message is being raised, there are two different ways to handle the error.
'Place the feature class in loadonly mode. This steps needs to happen prior to 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
'Take the feature class out of loadonly mode, the Geodatabase will calculcate an appropriate grid size based on the features within the feature class
pFCLoad.LoadOnlyMode = False