I'm trying to create a script tool to select all the features within a user-specified area of interest then run the Data Reviewer extension. I've encountered an issue trying to select features from a feature dataset. There are multiple feature datasets in my sde database, and I want to select all feature classes from one specific feature dataset. The code below runs up to the selected_aoi
variable.
Any suggestions on how to solve this?
import arcpy, os
arcpy.env.overwriteOutput = "true"
# User path to reviewer workspace
rev_workspace = arcpy.GetParameterAsText(0)
# RBJ file path
rbj_file = arcpy.GetParameterAsText(1)
# Open session
session_num = arcpy.GetParameterAsText(2)
# Select user AOI's using SQL
user_AOI = arcpy.GetParameterAsText(3)
# Path to production workspace
prod_workspace = r"X:\DataConnections\Utilities.sde"
# Path to the Water Distribution Feature Dataset
wat_fc_dataset = os.path.join(prod_workspace, "/Utilities.WaterDistribution")
# Select the AOI and Run Data Reviewer
try:
arcpy.AddMessage("Starting Process")
aoi_fc_select = os.path.join(prod_workspace +
"/Utilities.ModelCorrections/Utilities.WaterOperationalAreaCorrections")
arcpy.AddMessage("Selecting AOI")
arcpy.MakeFeatureLayer_management(aoi_fc_select, "selected_aoi_lyr", user_AOI)
arcpy.AddMessage("AOI Selected")
arcpy.AddMessage("Selecting features in AOI")
selected_aoi = arcpy.SelectLayerByLocation_management("selected_aoi_layer", "intersect", wat_fc_dataset)
arcpy.AddMessage("Features in AOI selected")
# Run the RBJ file
arcpy.AddMessage("Running Data Reviewer on selected features")
arcpy.ExecuteReviewerBatchJob_Reviewer(rev_workspace,session_num,rbj_file,prod_workspace, selected_aoi)
arcpy.AddMessage("Process Completed")
except:
arcpy.AddMessage("Failed to Execute")