Question

Update spatial index

  • 11 June 2020
  • 2 replies
  • 42 views

Hello everybody,

 

We are looking for a solution to update a spatial index in a Esri SDE database after the Geodatabase_SDE writer has finished writing the data. We are going the work with FME Desktop 2020. The only solution we could find is making an python script and use this in the "Shutdown python script" event.

 

Does anybody know an easier solution?

Greetings from the Netherlands


2 replies

Badge +2

You could use this code in the Shutdown Python Script in the workspace parameters,  and update target feature classes list:

import fme
import arcpy

arcpy.env.workspace  = fme.macroValues['TARGET_SDE_CONNECTION_FILE']
feature_class_list = ['fc1', 'fc2','fc3']

print('Update spatial index...')

# Recreate the spatial indexes
try:
    for fc in feature_class_list:
        arcpy.RemoveSpatialIndex_management(fc)
        print(arcpy.GetMessages(2))
        arcpy.AddSpatialIndex_management(fc)
        print(arcpy.GetMessages(2))
    print('Done.')

except:
    print(arcpy.GetMessages(2))

Thank you for your response,

 

But my client prefers a solution without python. Do you know if FME has a possibility for this?

Reply