TransWikia.com

ArcPy spatial join script error

Geographic Information Systems Asked by zaman on July 27, 2021

I made a model for spatial join and it is working properly but when I export as script and run in ArcPy it gave me error in spatial join. Here is the code

import arcpy

# Script arguments
Houses = arcpy.GetParameterAsText(0)
if Houses == '#' or not Houses:
    Houses = "Houses.shp" # provide a default value if unspecified

Sub_blocks = arcpy.GetParameterAsText(1)
if Sub_blocks == '#' or not Sub_blocks:
    Sub_blocks = "Sub_blocks.shp" # provide a default value if unspecified

Houses_sub_blocks_shp = arcpy.GetParameterAsText(2)
if Houses_sub_blocks_shp == '#' or not Houses_sub_blocks_shp:
    Houses_sub_blocks_shp = "E:MS2nd SemesterpythonDataNew dataHouses_sub_blocks.shp" # provide a default value if unspecified

alternatives = arcpy.GetParameterAsText(3)
if alternatives == '#' or not alternatives:
    alternatives = "alternatives" # provide a default value if unspecified

C1_houses = arcpy.GetParameterAsText(4)
if C1_houses == '#' or not C1_houses:
    C1_houses = "alternatives" # provide a default value if unspecified

# Local variables:

# Process: Spatial Join
arcpy.SpatialJoin_analysis(Sub_blocks, Houses, Houses_sub_blocks_shp)

# Process: Join Field
arcpy.JoinField_management(alternatives, "FID", Houses_sub_blocks_shp, "FID", "Join_Count")

and the error is

Error message

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP