Near_Analysis tool help

269
2
06-29-2011 11:40 AM
IgressT
New Contributor II
Hi ,
I am writing a python script that does the Near_Analysis. The script is as follows

This works
workspaceName = "C:\...\ShapeFiles"
nearFeatures="shapefile1.shp"
arcpy.Near_analysis (inputData, nearFeatures)


According to help http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Near/00080000001q000000/ it says I can specify more than 1 feature class as near features. So I modify my code as

This doesn't work (the directory C:\...\ShapeFiles has multiple shape files)
workspaceName = "C:\...\ShapeFiles"
nearFeatures="shapefile1.shp,shapefile2.shp"
arcpy.Near_analysis (inputData, nearFeatures)


I tried nearFeatures="[shapefile1.shp,shapefile2.shp]" , nearFeatures="shapefile1.shp,shapefile2.shp" and many other combinations but it doesnot work

Can anyone help me?
Tags (2)
0 Kudos
2 Replies
DarrenWiens2
MVP Honored Contributor
The intersect tool takes multiple feature classes in the form of ["shapefile1.shp", "shapefile2.shp"] (quotes, brackets, and comma delimited). I'd try that.
0 Kudos
DanPatterson_Retired
MVP Emeritus
Also, you cannot use single backslashes in folder paths, either preface them with raw notation or use double backslashes or single forward slashes
ie "c:\temp" is wrong
correct versions are
r"c:\temp"
"c:\\temp"
"c"/temp"
0 Kudos