Note:
Find Closest was named Find Nearest in Map Viewer Classic.
The Find Closest tool uses either a line distance or a travel mode to measure between input features and near features. For each input feature, the specified number of near features is ranked by distance from the input feature.
The output is a hosted feature layer.
Example
The director of Safety Services wants to determine which fire station in the city is closest to each of the schools in terms of driving time. The director wants to use this information, which can be collected using the Find Closest tool, to set primary and secondary responder stations for each school in case of an emergency.
Usage notes
Find Closest includes configurations for input layers, analysis settings, and result layers.
Input layers
The Input layers group includes the following parameters:
Input layer is used to select the layer for which the closest features are found. The layer can contain up to 5,000 features. You can choose a layer using the Layer button, or you can create a sketch layer to use as the input using the Draw input features button.
For feature inputs, a count of features is displayed below the layer name. The count includes all features in the layer, except features that have been removed using a filter. Environment settings, such as Processing extent, are not reflected in the feature count.
When lines or polygons are used as inputs, the closest location is found using the distance from or to the closest point along the line or on the boundary of the polygon.Near layer is used to select the layer from which features are found based on their proximity to the input layer. The layer can contain up to 5,000 features.
For feature inputs, a count of features is displayed below the layer name. The count includes all features in the layer, except features that have been removed using a filter. Environment settings, such as Processing extent, are not reflected in the feature count.- Optional barrier layers is used to add features that act as temporary restrictions when traveling on the underlying streets. The Optional barrier layers parameter includes the following subparameters:
- Point barrier layer—Point features that block traffic at a specific position along the street. Travel is permitted on the street but not through the barrier. You can specify up to 250 features to act as point barriers. Examples of point barriers include a fallen tree, a traffic accident, or a downed electrical line.
- Line barrier layer—Line features that block traffic across several street segments. The line barriers prohibit travel anywhere the barriers intersect the streets and can intersect up to 500 streets. Examples of line barriers include a parade or protest.
- Polygon barrier layer—Polygon features that block traffic across entire areas of the street network. The polygon barriers prohibit travel anywhere the polygon intersects the street and can intersect up to 2,000 streets. Examples of polygon barriers include a flood or forest fire.
You can choose a layer using the Layer button, or you can create a sketch layer to use as the input using the Draw input features button.
For feature inputs, a count of features is displayed below the layer name. The count includes all features in the layer, except features that have been removed using a filter. Environment settings, such as Processing extent, are not reflected in the feature count. For line and polygon barriers, support is determined by the number of intersecting streets rather than the count of features.
Analysis settings
The Analysis settings group includes the following parameters:
Measurement type is used to choose the measurement by which the closest features are found. The method can be Line distance or a travel mode.
Find Closest uses a geodesic method when finding features with a straight-line distance rather than a Euclidean method. Geodesic lines account for the actual shape of the earth (an ellipsoid, or more properly, a geoid). Distances are calculated between two points on a curved surface (the geoid) as opposed to two points on a flat surface (the Cartesian plane).
Travel modes are only available if you have the network analysis privilege and point features are used as the inputs.
Learn more about travel modes- Departure time specifies the date and time when travel begins to find closest features. This parameter impacts the travel speed for time-based travel modes and impacts the time accumulation for distance-based travel modes. The Departure time parameter options are as follows:
Now—Traffic conditions will be based on the current date and time. Live traffic conditions will be used when available.
Learn more about network analysis coverage- Custom date and time—Traffic conditions will be based on the specified date and time. If the custom date and time is within four hours of the current time, live traffic conditions will be used. If the custom date and time is not within four hours of the current date and time, average historical traffic conditions for the day of week and time of day will be used. Use this option to perform analysis with typical traffic conditions. For example, choose 9:00 a.m. on the previous Monday to perform analysis with typical conditions for Mondays at 9:00 a.m.
- Time unspecified—Travel speeds will be based on average historical speeds or the posted speed limit.
- Limit the number of closest locations is used to determine whether a custom maximum number of closest locations is used by the tool. If enabled, Max number of closest locations to find per input is available. If not enabled, the tool's maximum of 100 is used. This parameter is enabled by default.
- Max number of closest locations to find per input is used to specify the maximum number of closest locations that can be returned for each input feature. This parameter is available if Limit the number of closest locations is enabled.
Limit the search range is used to determine whether a custom maximum search range is used by the tool. If enabled, Max search range is available. If not enabled, the search range is unlimited.
When a limit is set on the search range, it's possible that the tool won't find any nearest locations within that range, or that fewer locations are found than the maximum number of nearest locations you specify.- Max search range and Max search range (minutes) determine the maximum distance or time required to travel between the input points and the points returned as closest features. Features outside of the search range will not be returned. This parameter is available if Limit the search range is enabled.
- Search range units is used to select the distance units (miles, kilometers, meters, feet, or yards) for measuring the maximum search range for distance-based measurement types.
Result layers
The Result layers group includes the following parameters:
- Output name specifies the name of the layer that is created and displayed. The name must be unique. If a layer with the same name already exists in your organization, the tool will fail and you will be prompted to use a different name.
- Include route layers saves each result route as a route layer. A route layer includes all the information for a particular route, such as the stops assigned to the route and the travel directions. Creating route layers is useful if you want to share the individual routes with other members in your organization. Click the individual result route to open a pop-up with options to edit, open the route layer, or zoom to the route.
- Save in folder specifies the name of a folder in My content where the result will be saved.
Limitations
The following limitations apply to the tool:
- There is a limit of 5,000 features in each of the two input layers.
- Travel modes are only enabled when point features are used as inputs.
- The maximum number of closest locations is 100.
- The processing time is dependent on the number of start locations, the number of near locations, and the maximum search range.
- The maximum number of route layers that can be created is 1,000. If the result contains more than 1,000 routes and Include route layers is checked, only the output feature service will be created.
- An error will occur if the tool takes more than 60 minutes to run. If this error occurs, try rerunning the analysis with fewer input features.
- You can specify up to 250 features to act as point barriers.
- If the number of street features intersected by all the line barriers exceeds 500, an error is returned.
- If the number of street features intersected by all the polygon barriers exceeds 2,000, an error is returned.
- The straight-line distance between input locations from the start locations layer and nearest locations layer cannot exceed 27 miles (43.45 kilometers) when the travel mode is Walking Time or Walking Distance.
- The Draw input features button is not available in Scene Viewer.
Environments
Analysis environment settings are additional parameters that affect a tool's results. You can access the tool's analysis environment settings from the Environment settings parameter group.
This tool honors the following analysis environments:
- Output coordinate system
- Processing extent
Note:
The default processing extent is Full extent. This default is different from Map Viewer Classic in which Use current map extent is enabled by default.
Credits
This tool consumes credits.
Use Estimate credits to calculate the number of credits that will be required to run the tool. For more information, see Understand credits for spatial analysis.
Outputs
This tool includes the following outputs:
- One layer with the closest features. The geometry of the output depends on the geometry of the near features.
- One line layer with the lines connecting the input features to the closest features.
One route layer per line (optional).
Learn more about route layers
Licensing requirements
This tool requires the following user type and configurations:
- Creator, Professional, or Professional Plus user type
- Publisher, Facilitator, or Administrator role, or an equivalent custom role
The Network Analysis privilege is required to run the tool using a travel mode.
Resources
Use the following resources to learn more:
- Find Nearest in ArcGIS REST API
- find_nearest in ArcGIS API for Python
- Calculate Travel Cost in ArcGIS Online
- Generate Near Table in ArcGIS Pro
- Near in ArcGIS Pro
- Point Distance in ArcGIS Pro
- Closest Facility solver in ArcGIS Pro with the ArcGIS Network Analyst extension