Select to view content in your preferred language

Disable spatial index while data is loading with arcpy InsertCursor

489
2
Jump to solution
01-08-2024 08:55 AM
Hildermes
Esri Contributor

At every row insert index are recalculated.
In .net to avoid it we can use IFeatureClassLoad to disable updating of the spatial index while data is loading https://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//0025000002rz000000

Is there an equivalent method with arcpy InsertCursor?

0 Kudos
1 Solution

Accepted Solutions
BlakeTerhune
MVP Regular Contributor

Reviewing the environment settings for arcpy, there's a note about the maintainSpatialIndex property:

Legacy:

The Maintain Spatial Index environment is not honored in ArcGIS Pro. To have the same behavior as the Maintain Spatial Index environment in ArcGIS Pro when running tools and workflows that perform insert, update, and delete operations on existing data in enterprise geodatabases, control of the spatial index can be accomplished using the Remove Spatial Index tool to remove the spatial index prior to processing and the Add Spatial Index tool to re-create the spatial index after processing.

The Append tool also supports this workflow with file geodatabase data.

So you should be able to utilize the remove spatial index and add spatial index tools to accomplish this.

View solution in original post

2 Replies
BlakeTerhune
MVP Regular Contributor

Reviewing the environment settings for arcpy, there's a note about the maintainSpatialIndex property:

Legacy:

The Maintain Spatial Index environment is not honored in ArcGIS Pro. To have the same behavior as the Maintain Spatial Index environment in ArcGIS Pro when running tools and workflows that perform insert, update, and delete operations on existing data in enterprise geodatabases, control of the spatial index can be accomplished using the Remove Spatial Index tool to remove the spatial index prior to processing and the Add Spatial Index tool to re-create the spatial index after processing.

The Append tool also supports this workflow with file geodatabase data.

So you should be able to utilize the remove spatial index and add spatial index tools to accomplish this.

Hildermes
Esri Contributor

https://github.com/Esri/arcgis-python-api/issues/1186
thanks that's exactly what I`m doing. So it is the correct route....I thought it might had another way.
It's good to have doc stating it though

0 Kudos