I have two polygon feature classes (buildings), one with attributes in green in the example below (building_sample.shp) and one with no attributes in red in the same example (building_sample_NA.shp).
I want the red buildings to take the attribute values of their closest green neighbor using arcpy.
Following the description of the SpatialJoin_analysis function, that should be easy but my code is not working:
ERROR 000210: Cannot create output
import arcpy
arcpy.env.workspace = "C:/DemoData/outputs"
arcpy.env.OverwriteOutput = True
arcpy.SpatialJoin_analysis (target_features = "building_sample_NA.shp",
join_features = "building_sample.shp",
out_feature_class = "building_completed",
join_operation = "JOIN_ONE_TO_ONE",
match_option = "CLOSEST")