AnsweredAssumed Answered

error 000622: Failed to execute (SpatialOverlay). Parameters are not valid.

Question asked by alicia.shyu1 on Dec 29, 2017
Latest reply on Jan 4, 2018 by alicia.shyu1

Hi, I'm writing a script that is part 2 of a bigger automation process. Part 1 was written by someone else (who, of course, doesn't work at the company anymore) and works perfectly. 

My script piggy backs on features created in part 1 and I'm getting 2 errors:

 

Traceback (most recent call last):
  File "Y:\BI\Alicia\Scripts\ShrinkModel_3_0_SingleSite_2016Data.py", line 46, in <module>
    arcpy.SpatialOverlay_ba(inputLayer, inputSimpleRing, ShrDemoFields, ShrSimpleRing)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.4\Business Analyst\ArcToolbox\Toolboxes\Business Analyst Tools.tbx", line 483, in SpatialOverlay
ExecuteError: ERROR 000622: Failed to execute (SpatialOverlay). Parameters are not valid.
ERROR 000800: The value is not a member of TOTPOP_CY | HHPOP_CY | FAMPOP_CY | GQPOP_CY | POPDENS_CY | TOTHH_CY | AVGHHSZ_CY | FAMHH_CY | AVGFMSZ_CY | TOTHU_CY | OWNER_CY | RENTER_CY | VACANT_CY | POPGRW10CY | HHGRW10CY | FAMGRW10CY | POP0_CY | POP5_CY | POP10_CY | POP15_CY | POP20_CY | POP25_CY | POP30_CY | POP35_CY | POP40_CY | POP45_CY | POP50_CY | POP55_CY | POP60_CY | POP65_CY | POP70_CY | POP75_CY | POP80_CY | POP85_CY | POP18UP_CY | POP21UP_CY | MEDAGE_CY |

I already checked my parameters and the only thing I didn't add were the last two optional parameters.

SpatialOverlay_ba (InputFeatureLayer, OverlayLayer, SelectedSummarizations, OutputFeatureClass,
{SpatialOverlayAppendData},
{UseSelectedFeatures})

For the 2nd error, I already checked the spelling of all 27 fields that I'm asking the overlay to get. I misspelled A55NW150CY originally as _CY. The data is the 2016 U.S. Data for BA extension. 

Any ideas on how to solve this conundrum?

Thanks and Happy New Year!!!

# Import arcview and arcpy library
import arcview
import arcpy

# Overwrite any previous output
arcpy.env.overwriteOutput = True

# Set workspace from the selection in tool menu
####myWorkspace = arcpy.GetParameterAsText(0)
####arcpy.env.workspace = myWorkspace
myWorkspace = "X:\Users\Alicia.Shyu\TestingScript\ScriptTest"
arcpy.env.workspace = myWorkspace
print myWorkspace

# Check out extensions for Business and Network Analyst
arcpy.CheckOutExtension("Business")
arcpy.CheckOutExtension("Network")
print ("Business Analyst and Network Analyst extensions available")

# Set spatial reference; 4269 is code for GCS_North_American_1983
spatialRef = arcpy.SpatialReference(4269)
print ("Spatial reference set")

# Add Business Analyst toolbox to script
arcpy.AddToolbox("C:\Program Files (x86)\ArcGIS\Desktop10.4\Business Analyst\ArcToolbox\Toolboxes\Business Analyst Tools.tbx")
print ("Business Analyst toolbox added")

# Set simple ring feature class from selection in tool menu
# Simple ring were created during internal model script
inputRing = arcpy.GetParameterAsText(1)

# Create variables for spatial overlay function
inputLayer = "C:\ArcGIS\Business Analyst\US_2016\Data\Demographic Data\esri_bg.bds"
ShrDemoFields = "POPDENS_CY; INDCONS_CY; INDRTTR_CY; OCCSSRV_CY; OCCHLTH_CY; OCCPERS_CY; OCCCONS_CY; \
                DIVORCD_CY; A45I15_CY; A55I0_CY; A55I50_CY; A25DI15_CY; A55NW15_CY; A55NW50_CY; \
                A55NW150CY; A65NW35_CY; A75NW15_CY; AGGNWA75CY; RURALHU10; RNT3PERS10; OOHHR75C10; \
                VACRENT10; VACRNTED10; VACSOLD10; VACOTHER10; VACRNTED100; VACSOLD100"

# Append shrink model data to simple ring feature class
ShrRing = "ShrinkSimpleRingAppend"
arcpy.SpatialOverlay_ba(inputLayer, inputRing, ShrDemoFields, ShrRing)
print ("Shrink Simple Ring Append Done")

# Set drive time feature class from selection in tool menu
# Drive time were created during internal model script
inputDriveTime = arcpy.GetParameterAsText(2)

# Append shrink model data to drive time feature class
ShrDriveTime = "ShrinkDriveTimeAppend"
arcpy.SpatialOverlay_ba(inputLayer, inputDriveTime, ShrDemoFields, ShrDriveTime)
print ("Shrink Drive Time Append Done")

# Set new workspace as output for Excel file
myWorkspaceTable = arcpy.GetParameterAsText(3)

# Export shrink simple ring data to Excel
excelExtension = ".xls"
ShrSimpRStr = "ShrinkSimpRTable"
ShrSimpRTable = myWorkspaceTable + "/" + ShrSimpRStr + excelExtension
arcpy.TableToExcel_conversion(ShrSimpleRing, ShrSimpRTable)
print ("Shrink Simple Ring Table Done")

# Export shrink drive time data to Excel
excelExtension = ".xls"
ShrinkDrivTStr = "ShrinkDrivTTable"
ShrinkDrivTTable = myWorkspaceTable + "/" + ShrinkDrivTStr + excelExtension
arcpy.TableToExcel_conversion(ShrinkDriveTime, ShrinkDrivTTable)
print ("Shrink Drive Time Table Done")

# Return Business Analyst and Network Analyst extensions
arcpy.CheckInExtension("Business")
arcpy.CheckInExtension("Network")
print ("Business Analyst and Network Analyst extensions returned")
print ("Done")

Outcomes