batch spatial join - python

Lara BK laritaba at
Sun Jul 19 14:11:45 CEST 2015


I would like to do a spatial join in a batch process in python. 

# I have this layers: 

neighbourhood = "D:\\Users\\laraifat\\Desktop\\pythonproject\\layers\\neighbourhood.shp"
buildings = "D:\\Users\\laraifat\\Desktop\\pythonproject\\layers\\buildings.shp"
openspace = "D:\\Users\\laraifat\\Desktop\\pythonproject\\layers\\openspace.shp"
buses = "D:\\Users\\laraifat\\Desktop\\pythonproject\\layers\\buses.shp"
education = "D:\\Users\\laraifat\\Desktop\\pythonproject\\layers\\education.shp"
health = "D:\\Users\\laraifat\\Desktop\\pythonproject\\layers\\health.shp"
sport_point_shp = "D:\\Users\\laraifat\\Desktop\\pythonproject\\layers\\sport_point.shp"

#I created this variables with the layers:

input_features = [sport_point_shp, health, buses, education] #the layers that will be used to count the buildings inside the neighbourhood layer
new_layers = ["join_sport", "join_health", "join_buses", "join_education"] # the layer that will be created after join 

arcpy.BatchSpatialJoin_analysis(neighbourhood, input_features, new_layers, "JOIN_ONE_TO_ONE", "KEEP_ALL", "", "INTERSECT")

#### but when i run the script is says:

Runtime error 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'BatchSpatialJoin_analysis'

How can i solve this problem? 

Thank you! 

More information about the Python-list mailing list