Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

How to batch process near feature distance in ArcGIS

$
0
0

I have 2000+ point shape files. These are all GPS tracks. I want to calculate the distance from each point to the nearest feature (road, train line, restaurant etc) within a 30 meter radius. I am using Near feature from proximity analysis in ArcGIS. I am facing two problems.

  1. Using batch processing one can add as many input rows in Near feature tool box as s/he wants. But this requires selecting each file
    one by one which is time consuming especially when there are thousands
    of files. So I tried using a python scripting as follows. But after
    processing the result is written in the same file. I want to write the
    table separately. How can I do that?
  2. In case I want to add different columns for each features say road, train network for each point record in a file using near feature
    how can I do that?

Currently, I am using the following python code but all the output are generated on the current file. I want to write it separately (I mean I want to generate a new table/file after near_analysis)

import arcpy # Import arcpy module

# path where all my point shp files are kept
arcpy.env.workspace = r'C:ArcGIS sample data' 

#feature to which distance will be calculated
nearFeature_shp = 'C:\GIS route network\road.shp' 

# looping through all the files
for file in arcpy.ListFeatureClasses (): 

    # Process: Near
    arcpy.Near_analysis(file, nearFeature_shp , "30 Meters", "LOCATION", "ANGLE") 

Viewing all articles
Browse latest Browse all 767

Trending Articles