# Distance Tool

The Distance tool calculates 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.

- 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).
- 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).
- 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 will return 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

- Choose the Spatial Object Fields to calculate the distance between.
- Point or Centroid Source: The source must be a point or the centroid of a polygon to measure from.
- 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.
- Output Distance When checked, the calculated distance will be outputted in an appended data field.
- Create the Nearest Interior Point Inside of the Polygon. Checking this box will 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.
- Select the preferred behavior of what to do When a point is inside a polygon. Choices include:
- Return a distance of 0
- Return the distance of the nearest edge

- Output Drivetime & Distance to Destination Centroid checkbox. When checked, the drivetime in minutes from source to destination will be calculated.
- 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.
- Select the method for your route to be optimized. Choices include:
- 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, drive distance is returned. Drivetime is not returned because road speeds were all set to be the same to calculate the most direct route.
- Allow Reversed Routing for Optimum Speed: When checked, the engine will try to determine if you have significantly more "Source" points than "Destination" points, and if so, it will reverse the two. This will result in somewhat different drivetimes (because of one-way streets), but can yield enormous performance improvements.
- Output Cardinal Direction: When checked, the direction (N, NE, SW, etc.) is output in an appended data field.
- Output Direction in Degrees: When checked, the distance direction in degrees will be outputted in an appended data field.
- In the Units section, click Miles, Kilometers, Meters, or Feet to specify the unit of measure.

Optimize calculation

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

You can specify the default dataset from User Settings. Go to Options > User Settings > Edit User Settings and click the Dataset Defaults tab.

Drivetime is only available if you have the Drivetime engine installed.