ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Near

Available with Advanced license.

  • Summary
  • Illustration
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Computes the distance from each point in a coverage to the nearest arc, point, or node in another coverage.

Illustration

Near 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:

    Near Items output

    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})
ParameterExplanationData 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.

  • LINE —A point-to-arc distance will be determined. New items for distance and the internal number of the closest arc in the <near_cover:> will be added to the <input_cover> PAT. This is the default option.
  • POINT —A point-to-point distance will be determined. New items for distance and the internal number of the closest point in the <near_cover:> will be added to the <input_cover> PAT.
  • NODE —A point-to-node distance will be determined. New items for distance and the internal node number of the closest node in the <near_cover:> will be added to the <input_cover> PAT.
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.

  • NO_LOCATION —The x,y coordinates of the nearest point are not saved. This is the default.
  • LOCATION —The x,y coordinates of the nearest point, as well as the cover# and distance, will be saved.
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

  • Current Workspace
  • Level Of Comparison Between Projection Files
  • Precision For Derived Coverages
  • Precision For New Coverages
  • Scratch Workspace

Licensing information

  • Basic: No
  • Standard: No
  • Advanced: Requires ArcInfo Workstation installed

Related topics

  • An overview of the Proximity toolset
  • An overview of the Proximity toolset

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal