Available with Advanced license.
Summary
Computes the distance from each point in a coverage to the nearest arc, point, or node in another coverage.
Illustration
Usage
The search radius is the maximum distance in coverage units a feature can be from the current point for consideration as the closest feature. The default is the width or height of the near coverage BND divided by 100, whichever is larger.
The results are recorded in the Output coverage point attribute table (PAT). Items for DISTANCE and the internal number of the closest feature are added or updated; items for x and y coordinates are added when Record x,y coordinates of nearest feature are checked. All item values are set to zero if no feature is found within the search radius.
DISTANCE values are recalculated if this item already exists in the input coverage. If the DISTANCE item is added, it will be in the same precision as the coverage.
Items output by NEAR include:
These items are added to the input coverage PAT. If an item named DISTANCE already exists, the values will be recalculated. If the DISTANCE item is added, it will be in the same precision as the coverage. The values for both items will be zero if no match is found within the search_radius for a particular input coverage point.
The calculated distance from point to arc will be from the point to the nearest location along the arc. The calculated distance from point to node will be between the nearest node locations on the arcs.
The distance and the internal number of the closest feature are saved as new items in the input coverage's feature attribute table.
NEAR skips duplicate node numbers to increase operation time.
The coordinate precision of input coverage is not affected by NEAR.
NEAR is useful for assigning point attributes to nearest arcs, or vice versa. This operation is helpful in assigning address ranges to arcs; associating point attributes to nodes, such as DIME node numbers; or finding the nearest available line in a network (for example, determining which sewer line a property might connect with).
Common uses for Near include:
- Assigning point attributes to nearest arcs, or visa versa.
- Assigning address ranges to arcs.
- Associating point attributes to nodes, such as DIME node numbers.
- Finding the nearest available line in a network.
Syntax
arcpy.arc.Near(in_cover, near_cover, out_cover, {feature_type}, {search_radius}, {location})
Parameter | Explanation | Data Type |
in_cover | The coverage containing points from which distances are calculated to each closest arc, point, or node in the <near_cover:>. | Coverage |
near_cover | The line or point coverage whose features are used to calculate distances from each input cover point. This must be different from the input cover. | Coverage |
out_cover | The coverage to be created. The <input_cover> is copied to the <output_cover:>, then NEAR is performed on the <output_cover:>. | Coverage |
feature_type (Optional) | The type of feature that will be searched from points to find the nearest feature and calculate the distance between them.
| String |
search_radius (Optional) | The maximum distance in coverage units between input cover features and near cover features for which distance and near cover internal number will be determined. If no near cover feature is within the search radius of a given input cover point or line, both the internal number and distance output by NEAR will be zero. The default search radius is the width or height of the near coverage BND divided by 100, whichever is larger. This default search radius is used whenever the search radius argument is set to zero or skipped. | Double |
location (Optional) | Determines whether the x,y coordinates of the "nearest point" of the closest arc, point, or node are to be saved as well as the cover# and distance. The new items are X-COORD and Y-COORD.
| Boolean |
Code sample
Near example (stand-alone script)
The following stand-alone script demonstrates how to calculate the distances between wells in one coverage and roads in another.
# Name: Near_Example.py
# Description: Computes the distances between wells and roads
# Requirements: ArcInfo Workstation
# Import system modules
import arcpy
from arcpy import env
# Set environment settings
env.workspace = "C:/data"
# Set local variables
inCover = "wells142"
nearCover = "road"
outCover = "C:/output/nearwells"
featureType = "LINE"
searchRadius = 12000
location = "LOCATION"
# #Execute Near
arcpy.Near_arc(inCover, nearCover, outCover, featureType,
searchRadius, location)
Environments
Licensing information
- Basic: No
- Standard: No
- Advanced: Requires ArcInfo Workstation installed