Skip to main content

Green icon with measuring device inside. Distance Tool

One Tool Example

Distance has a One Tool Example. Go to Sample Workflows to learn how to access this and many other examples directly in Alteryx Designer.

Use Distance to calculate the ellipsoidal direct point-to-point, point-to-edge, or the drive distance between two sets of spatial objects.

There are three types of distance calculation relationships available.

  1. Point-to-point: The Distance tool calculates the distance between two sets of point type spatial objects. An example is calculating the distance from records in a customer file (point type) to records in a store file (point type).

  2. Point-to-edge (line): The Distance tool calculates the distance between a set of point type spatial objects and the closest edge of a set of line type spatial objects. An example is calculating the distance from the records in a customer file (point type) to the nearest interstate highway (edge of line spatial type).

  3. Point-to-edge (polygon): The Distance tool calculates the distance between a set of point type spatial objects and the closest edge of a set of polygon type spatial objects.

    • When the points are contained within the polygons, you can choose one of two options: Return a distance of zero, or Return the distance to the nearest edge. If the point is located inside of a polygon the Distance tool returns a negative number for the distance to the edge of the containing polygon.

    • When the points are contained outside of the polygons, you can also choose to have the Distance tool calculate the Nearest Interior point within the nearest edge of a polygon.

    • While this method of calculating distance takes the curvature of the Earth into consideration, it is not a routing routine and does not follow street patterns or honor physical barriers such as bodies of water.

Configure the Tool

Follow these steps to configure the tool.

  1. Choose the Spatial Object Fields to calculate the distance between them.

  2. Point or Centroid Source: The source must be a point or the centroid of a polygon to measure from.

  3. Point, Line, or Polygon Destination: The destination can be any type of spatial object: point, line, polyline, or polygon, and the distance is calculated to reach the closest part of the object.

    Note

    To optimize the processing speed, connect to the larger spatial object in Destination.

  4. Output Distance: When checked, the calculated distance is output in an appended data field.

    1. Create the Nearest Interior Point Inside of the Polygon. Check this box to add a spatial point object to the data stream. It is the distance between the specified Source and this newly created Point that is returned.

    2. Select the preferred behavior of what to do When a point is inside a polygon.

      • Return a distance of 0

      • Return the distance to the nearest edge

  5. Output Drivetime & Distance to Destination Centroid checkbox. When checked, the drivetime in minutes from source to destination is calculated.

    1. Choose the dataset to use in calculating the drivetime and drive distance. If you only have one dataset 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 select the Tools tab. Next, use the Dataset Defaults section to make your selections.

    2. Select the method for your route to be optimized.

      • Time: This is the default route. This method finds the route based on the least amount of time between points. When this method is selected, both drivetime and drive distance are returned.

      • Distance: This method ignores road speeds to find the most direct route between points. When this method is selected, the drive distance is returned. Drivetime is not returned because road speeds were all set to be the same to calculate the most direct route.

      Note

      Values outside of the maximum do not return an error, but they do not calculate either.

    3. Allow Reversed Routing for Optimum Speed: When checked, the engine tries to determine if you have significantly more "Source" points than "Destination" points, and if so, it reverses the two. This results in somewhat different drivetimes (because of one-way streets), but can yield enormous performance improvements. Drivetime is only available if you have the Drivetime engine installed.

  6. Output Cardinal Direction: When checked, the direction (N, NE, SW, etc.) is output in an appended data field.

  7. Output Direction in Degrees: When checked, the distance direction in degrees is output in an appended data field.

  8. In the Units section, select Miles, Kilometers, Meters, or Feet to specify the unit of measure.