Select to view content in your preferred language

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

5845
11
Jump to solution
12-29-2017 08:34 AM
by Anonymous User
Not applicable

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")
0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

line 23 and 32 still need raw formatting ... r'....

I wonder if it has something to do with your fancy formatting, since you have a whole load of spaces before the actual names... observe

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"

ShrDemoFields
Out[14]: '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'

ShrDemoFields_list = ShrDemoFields.split(";")

ShrDemoFields_list
Out[16]: 
['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']


# ---- I removed the BIG spaces below

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"

ShrDemoFields
Out[18]: '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'

# ---- then I replaced the single spaces ----

ShrDemoFields.replace(" ", "")
Out[19]: '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'

# ---- now a lot of Arc* software uses semi-colon delimited text strings which are
#      parsed to lists

test_list = ShrDemoFields.split(";")

# ---- resulting in a clean list.... but the above space replacement stuff may suffice

test_list
Out[24]: ['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']

View solution in original post

11 Replies
JoshuaBixby
MVP Esteemed Contributor

Looking at the error and traceback, you are calling Spatial Overlay with 4 arguments: inputLayer, inputSimpleRing, ShrDemoFields, ShrSimpleRing. When I look at the code/script provided, I don't see where inputSimpleRing or ShrSimpleRing are defined.  What am I missing?

0 Kudos
by Anonymous User
Not applicable

I see my mistake but even after making sure all the variables are defined. I'm still getting the same errors.

Traceback (most recent call last):
  File "Y:\BI\Alicia\Scripts\ShrinkModel_3_0_SingleSite_2016Data.py", line 48, in <module>
    arcpy.SpatialOverlay_ba(inputLayer, inputRing, ShrDemoFields, ShrRing)
  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 
0 Kudos
JoshuaBixby
MVP Esteemed Contributor

It is helpful if you re-post your code after making the updates/corrections.  Knowing exactly what arguments are being passed to the functions is key for those of use trying to help you.

0 Kudos
by Anonymous User
Not applicable

ok, here is the updated code:

# 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 = r'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)
inputRing = r'X:\Users\Alicia.Shyu\TestingScript\ScriptTest\InternalData.gdb\Buffer_LocationXY_ScriptTest'

# 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)
inputDriveTime = r'X:\Users\Alicia.Shyu\TestingScript\ScriptTest\InternalData.gdb\DriveTime_LocationXY_ScriptTest'

# 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
    ####myWorkspaceFolder = arcpy.GetParameterAsText(3)
myWorkspaceFolder = r'X:\Users\Alicia.Shyu\TestingScript\ScriptTest'

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

# Export shrink drive time data to Excel
excelExtension = ".xls"
ShrinkDrivTStr = "ShrinkDrivTTable"
ShrinkDrivTTable = myWorkspaceFolder + "/" + 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")

Here is the error I get after updating the code:

Traceback (most recent call last):
  File "Y:\BI\Alicia\Scripts\ShrinkModel_3_0_SingleSite_2016Data.py", line 49, in <module>
    arcpy.SpatialOverlay_ba(inputLayer, inputRing, ShrDemoFields, ShrRing)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.4\Business Analyst\ArcToolbox\Toolboxes\Business Analyst Tools.tbx", line 263, 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 |
0 Kudos
DanPatterson_Retired
MVP Emeritus

line 23 and 32 still need raw formatting ... r'....

I wonder if it has something to do with your fancy formatting, since you have a whole load of spaces before the actual names... observe

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"

ShrDemoFields
Out[14]: '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'

ShrDemoFields_list = ShrDemoFields.split(";")

ShrDemoFields_list
Out[16]: 
['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']


# ---- I removed the BIG spaces below

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"

ShrDemoFields
Out[18]: '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'

# ---- then I replaced the single spaces ----

ShrDemoFields.replace(" ", "")
Out[19]: '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'

# ---- now a lot of Arc* software uses semi-colon delimited text strings which are
#      parsed to lists

test_list = ShrDemoFields.split(";")

# ---- resulting in a clean list.... but the above space replacement stuff may suffice

test_list
Out[24]: ['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']

by Anonymous User
Not applicable

You're right, it was the formatting. Thank you!!

DanPatterson_Retired
MVP Emeritus

could you start by raw formatting all your paths to rule out issues that may be indirectly related.

if you are using backslashes to specify paths, use r'c:\yourpathhere' ... with the little 'r' in front.  especially since you are using python 2.7 presumably.  In python 3 (aka in Pro), your paths will fail miserably, so prepare for the future.

0 Kudos
by Anonymous User
Not applicable

I replaced all the variables with actual paths and got the same error.

X:\Users\Alicia.Shyu\TestingScript\ScriptTest
Business Analyst and Network Analyst extensions available
Spatial reference set
Business Analyst toolbox added

Traceback (most recent call last):
  File "Y:\BI\Alicia\Scripts\ShrinkModel_3_0_SingleSite_2016Data.py", line 49, in <module>
    arcpy.SpatialOverlay_ba(inputLayer, inputRing, ShrDemoFields, ShrRing)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.4\Business Analyst\ArcToolbox\Toolboxes\Business Analyst Tools.tbx", line 263, 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 | 
0 Kudos
DanPatterson_Retired
MVP Emeritus

like this 

'X:\Users\Alicia.Shyu\TestingScript\ScriptTest'

or raw formatted... like

r'X:\Users\Alicia.Shyu\TestingScript\ScriptTest'

my comment was about the lack of proper path specification when using python in scripts

0 Kudos