The 'Find Nearest' tool in Alteryx allows you to locate the closest (find nearest) spatial point when compared to a selection of other spatial points. The tool works by first choosing one point (one row) of group A and comparing it all possible points in group B.
![](https://www.thedataschool.co.uk/content/images/2022/04/image-113.png)
First we need to identify our two groups to compare. I have chosen A & B as shown.
![](https://www.thedataschool.co.uk/content/images/2022/04/image-114.png)
![](https://www.thedataschool.co.uk/content/images/2022/04/image-115.png)
Next we need to add these to our Find Nearest input anchors. The tool has two input anchors 'T' and 'U'. U represents our Universe, this will be the list of points we will comparing out T against to find the closest. T represents our targets, each row of T will be compared to every row of U.
In this example I have chosen to input group A into T and group B into U.
![](https://www.thedataschool.co.uk/content/images/2022/04/image-117.png)
The next step is to configure our Find Nearest tool as shown below:
![](https://www.thedataschool.co.uk/content/images/2022/04/image-118.png)
First we need to state our Spatial Object Field for both T and U. As seen on the configuration page, U can also be called from a predetermined file or database. Next we need to select how many points to find, I have selected 1. As well as the distance to find said points, In this example I have selected a range of 2 miles, if a member of T cannot find a member of U within 2 miles of itself it will be unmatched and therefore returned out of the U output anchor, those that match will be returned via the M output anchor as shown:
![](https://www.thedataschool.co.uk/content/images/2022/04/image-120.png)
Once we hit run we can see the output of the M anchor:
![](https://www.thedataschool.co.uk/content/images/2022/04/image-121.png)
Here we can see that within a 2 mile radius, point B has matched with 2 and point C with 3. Accompanied with it's distance and direction.
Whereas the output of the U anchor is as follows:
![](https://www.thedataschool.co.uk/content/images/2022/04/image-122.png)
As points A & D were unable to find a match within a 2 mile radius to any points in group B, their points have simply been returned sad and alone via the U anchor.
The browse tool can also be used to observe the spatial points visually as shown below for the M output browse tool:
![](https://www.thedataschool.co.uk/content/images/2022/04/image-123.png)