Hi All,
I'm using ArcgGIS 10.2.2. I have two feature class point layers, one containing 10 points (origins) and one containing 800+ points (destinations). I'm trying to find out how many destinations there are within a certain distance of each origin. e.g. Within 10km of origin 1 there are 300 destinations; within 25km of origin 1 there are 500 destinations; within 10km of origin 2 there are 350 destinations; within 25km of origin 6 there are 600 destinations etc. etc.
This is distance 'as the crow flies' so there is no need to build a network.
The points in both layers are close together which means there are many points that will fall into different distances for different origins. e.g. point 1 may be within 10km of origin 1, 10km of origin 8 and 25km of origin 10.
Can anyone offer advice on the simplest way of finding this out? Is there a tool that fits this purpose?
My initial thought was to create a buffer ring around each origin, convert these to polygons and then select all the destinations within each polygon. However the output from creating buffer rings does not enable me to identify which ring belongs to which origin. I also tried the point distance tool but this just tells me how many points are within a certain distance of all the origins, not each origin.
Do I need to create feature classes for each origin then deal with each origin individually, either with buffers or the point distance tool? If this is the case, then this is not so bad with only 10 origins but what if I had 100 origins? Surely there's a simpler way of doing it?
I have also searched the forum for a solution but haven't been able to find anything that directly relates to this.
Many thanks in advance for any help offered.
Adam
Hi Adam,
One way you can do this is using a python script. Below is an example.
The code iterates through a list of distances, and then iterates through each feature within the Origin feature class. It creates a feature layer for each feature, and executes the Point Distance tool to find how many destinations are within the specified distance.
import arcpy from arcpy import env env.workspace = r"C:\Temp\Python\Test.gdb" env.overwriteOutput = 1 origin = "Origin" destinations = "Destinations" distances = ["1000 Meters", "2000 Meters", "3000 Meters"] for distance in distances: with arcpy.da.SearchCursor(origin, ["OID@"]) as cursor: for row in cursor: OID = row[0] arcpy.MakeFeatureLayer_management(origin, "fcLyr", "OBJECTID = " + str(OID)) arcpy.PointDistance_analysis("fcLyr", destinations, "IN_MEMORY\\resultTable", distance) arcpy.GetCount_management("IN_MEMORY\\resultTable") print str(OID) + " has " + str(arcpy.GetMessage(2).split("= ")[-1]) + " destinations within " + distance del cursor
Hi Adam,
You can start with Multiple Ring Buffer (Analysis) for Layer 1. Keep Dissolve option as NONE.
Then use Spatial Join (Analysis).
Target Feature: Layer2.
Join Feature: Buffer Layer
Join Operation: JOIN_ONE_TO_MANY
Match Option: COMPLETELY_WITHIN
Hope it would resolve your issue.
Thanks,
Jay
Hi Adam,
Have you considered the Point Distance (Analysis) tool? The 4th parameter search_radius could be used to determine points that are 'within a distance'. Or, the Spatial Join (Analysis) it has parameters for match option and a distance field name.
Hi All,
Thanks for your input. In the end I went with Jayanta's solution which works fine. I have zero programming skills so I couldn't try Jake's code. David - I had tried this already but it didn't work as there is no way to differentiate between the different origins and the output provides a table which shows all of the destinations within the specified distance of all the origins collectively.
Thanks again for the advice.
Adam