Natural Neighbor (Spatial Analyst)
Summary
Interpolates a raster surface from points using a natural neighbor technique.
Usage
-
If the cell center of the perimeter cells of the output raster fall outside the convex hull (defined by the input points), then those cells will be assigned NoData values. If an input point falls within one of these perimeter cells and the cell center falls outside the convex hull, the cell will still be assigned a value of NoData.
-
Some input datasets may have several points with the same x,y coordinates. If the values of the points at the common location are the same, they are considered duplicates and have no affect on the output. If the values are different, they are considered coincident points.
The various interpolation tools may handle this data condition differently. For example, in some cases the first coincident point encountered is used for the calculation; in other cases the last point encountered is used. This may cause some locations in the output raster to have different values than what you might expect. The solution is to prepare your data by removing these coincident points. The Collect Events tool in the Spatial Statistics toolbox is useful for identifying any coincident points in your data.
-
This tool has a limit of approximately 15 million input points. If your input feature class contains more than a very large number of points (around 15 million or greater), the tool may fail to create a result.
You can avoid this limit by processing your study area in several sections and mosaicking the results into a single large raster dataset. Ensure that there is some overlap between the sections. Alternatively, you can use a Terrain dataset to store and visualize points and surfaces comprised of billions of measurement points.
It is recommended that the input data be in a projected coordinate system rather than in a geographic coordinate system.
-
If the ArcGIS 3D Analyst extension is available, an alternative approach is to use a TIN dataset. First, create a TIN from your source data. Then, convert the resulting TIN to a raster with the TIN To Raster tool, using the Natural Neighbors option. This is particularly useful if you have breaklines or an irregularly shaped data area.
Syntax
Parameter | Explanation | Data Type |
in_point_features |
The input point features containing the z-values to be interpolated into a surface raster. | Feature Layer |
z_field |
The field that holds a height or magnitude value for each point. This can be a numeric field or the Shape field if the input point features contain z-values. | Field |
cell_size (Optional) |
The cell size at which the output raster will be created. This will be the value in the environment if it is explicitly set; otherwise, it is the shorter of the width or the height of the extent of the input point features, in the input spatial reference, divided by 250. | Analysis Cell Size |
Return Value
Name | Explanation | Data Type |
out_raster |
The output interpolated surface raster. | Raster |
Code Sample
This example inputs a point shapefile and interpolates the output surface as a TIFF raster.
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outNaturalNeighbor = NaturalNeighbor("ozone_pts.shp", "ozone", 2000)
outNaturalNeighbor.save("C:/sapyexamples/output/nnout.tif")
This example inputs a point shapefile and interpolates the output surface as a Grid raster.
# Name: NaturalNeighbor_Ex_02.py
# Description: Interpolate a series of point features onto a
# rectangular raster using Natural Neighbor interpolation.
# Requirements: Spatial Analyst Extension
# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *
# Set environment settings
env.workspace = "C:/sapyexamples/data"
# Set local variables
inPointFeatures = "ca_ozone_pts.shp"
zField = "ozone"
cellSize = 40000
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute NaturalNeighbor
outNatNbr = NaturalNeighbor(inPointFeatures, zField, cellSize)
# Save the output
outNatNbr.save("C:/sapyexamples/output/nnout02")