Green icon with target and plot points inside.

Find Nearest Tool

Last modified: December 27, 2019

Identify the shortest distance between spatial objects in one file and the objects in a second file.

Applications include finding the closest store locations to consumers in the customer file (both point files); identifying the closest cell towers (point files) to LATAs (polygon files); or selecting congressional districts (polygon files) within 50 miles of a major thoroughfare (line file).

A Universe input connection into this tool is optional, as this file can be specified with an input path.

If using DriveTime, see Guzzler Drivetime Methodology for more information.

Tool configuration

The Find Nearest Point tool accepts two spatial inputs.

  1. Select the Spatial Object Field to use for the Targets (T Input). Any object type can be chosen for the Target, but if it is a not a point type object, the centroid is used for analysis.
  2. Specify the Universe object. There are two choices:
    • Use Records from U Input: Select the Spatial Object field from the data going into the tool.
    • Use Records from Data Source: When reading in spatial objects from a data source, make sure the data source that is being brought in has already been sorted on the spatial object. Ensure no connection is going into the U input.
      1. To specify the input data source, either enter the file path location of the input or browse to the data source's location.
      2. Select the Spatial Object Field from the input data source to calculate the nearest distance to.
  3. How many nearest points to find?: Specify how many nearest Universe objects to find for each Target. The default is 1. The Find Nearest tool can return more records than selected in the “How many nearest points to find?” field if there are multiple records in Universe the same distance from the Target object.
  4. Set the Maximum Distance and units of measure these objects can be from the Target. If Drive time is to be calculated, the user can specify the dataset they wish to use to calculate this figure. If only one dataset is installed, you will not have the option to select another dataset. You can specify the default dataset from User Settings. Go to Options > User Settings > Edit User Settings and click the Dataset Defaults tab.
  5. Choose whether or not to Ignore 0 Distance Matches. When checked, a point never matches to itself. If you are expecting the same number of input records as output records, ensure you do not have any duplicates in your data stream.
  6. Use the table to modify the incoming data stream. Each row in the table represents a column in the data.

Select, deselect, and reorder columns

To include a column in data, select the check box to the left of the column name. Deselect the check box to exclude the column.

To reorder the columns of data:

  1. Click to highlight a row, or click and drag down to highlight multiple rows.
  2. Click the Up icon or Down icon arrows, or right-click and drag, to move the rows to a new location.

The Unknown column is selected by default. It allows new columns in the data. Move the column to the location where you want a new column to be.

Modify data type and size

To change the supported length (characters for string and numeric fixed decimal types) or measurement (bytes for other numeric types) of data in a column, click Size and type a number. Size varies by data type and can be edited for fixed decimal numeric types and all string types. See Data Types.

Use the [data type]: Forced option to ensure a column always contains the expected data type; this is helpful when creating macros. See Macros.

Rename a column or add a description

To change the name of a column, click Rename and type the new name.

To add a description, click Description and type a description.

View more options

After selecting or highlighting rows (columns of data) in the table, click Options to view more configuration options:

  • Save/Load: Save the column configuration as a .yxft file. The Alteryx Field Type File is a text file can be used in other workflows using the Load Field Names or Load File Names and Types options.
  • Select: Select or deselect all or highlight columns. Options include Select All and Deselect All.
  • Change Field Type of Highlighted Fields: Change the data type of all highlighted columns at once.
  • Sort: Sort the column order in ascending or descending order. Options include Sort on Original Field Name, Sort on New Field Name, and Sort on Field Type, or Revert to Incoming Field Order.
  • Move: Move highlighted columns to the top or bottom of the list.
  • Add Prefix to Field Names: Add a prefix to the selected or highlighted column name.
  • Add Suffix to Field Names: Add a suffix to the selected or highlighted column name.
  • Remove Prefix or Suffix: Remove the prefix or suffix from the selected or highlighted column name.
  • Clear All Renames: Remove the new name for all columns.
  • Clear Highlighted Renames: Remove the new name for all highlighted columns.
  • Revert All to Original Type and Size: Undo all changes to type and size in all columns and use the original values.
  • Revert Highlighted to Original Type and Size: Undo changes to type and size in the selected or highlighted columns and use the original values.
  • Forget All Missing Fields: Remove all columns that are no longer included in the data.
  • Forget Highlighted Missing Fields: Remove all highlighted columns that are no longer included in the data.
  • Deselect Duplicate Fields: Deselect the second column when duplicate column names exist; this optional is only available with multiple inputs.
    Was This Helpful?

    Running into problems or issues with your Alteryx product? Visit the Alteryx Community or contact support.