Point Statistics (Spatial Analyst)

License Level:BasicStandardAdvanced

Summary

Calculates a statistic on the points in a neighborhood around each output cell.

Learn more about how Point Statistics works

Usage

Syntax

PointStatistics (in_point_features, field, {cell_size}, {neighborhood}, {statistics_type})
ParameterExplanationData Type
in_point_features

The input point features for which to calculate the statistics in a neighborhood around each output cell.

The input can be either a point or multipoint feature class.

Feature Layer
field

Field can be any numeric field of the input point features.

It can be the Shape field if the input features contain z.

Field
cell_size
(Optional)

Cell size for output raster dataset.

This is the value in the environment if specifically set. If not set in the environment, it is the shorter of the width or height of the extent of the input feature dataset, in the output spatial reference, divided by 250.

Analysis Cell Size
neighborhood
(Optional)

The Neighborhood class dictates the shape of the area around each input point used to calculate the statistic.

The different types of neighborhood available are NbrAnnulus, NbrCircle, NbrRectangle, and NbrWedge.

The following are the forms of the neighborhoods:

  • NbrAnnulus({innerRadius}, {outerRadius}, {CELL | MAP})
  • NbrCircle({radius}, {CELL | MAP}
  • NbrRectangle({width}, {height}, {CELL | MAP})
  • NbrWedge({radius}, {start_angle}, {end_angle}, {CELL | MAP})

The {CELL | MAP} parameter defines the distance units as either being Cell units or Map units.

The default neighborhood is a square NbrRectangle with a width and height of 3 cells.

Neighborhood
statistics_type
(Optional)

The statistic type to be calculated.

The calculation is performed on the values of the specified field of the point input in the neighborhood of each output raster cell.

  • MEAN Calculates the average of the field values in each neighborhood.
  • MAJORITY Determines the most frequently occurring field value in each neighborhood. In the case of a tie, the lower value is used.
  • MAXIMUM Determines the largest field value in each neighborhood.
  • MEDIAN Determines the median field value in each neighborhood. In the case of an even number of points in the neighborhood, the result will be the lower of the two middle values.
  • MINIMUM Determines the smallest field value in each neighborhood.
  • MINORITY Determines the least frequently occurring field value in each neighborhood. In the case of a tie, the lower value is used.
  • RANGE Calculates the range (difference between largest and smallest) of the field values in each neighborhood.
  • STD Calculates the standard deviation of the field values in each neighborhood.
  • SUM Calculates the total of the field values in each neighborhood.
  • VARIETY Calculates the number of unique field values in each neighborhood.
String

Return Value

NameExplanationData Type
out_raster

The output point statistics raster.

Raster

Code Sample

PointStatistics example 1 (Python window)

This example determines a statistic (the sum) on the input shapefile point features that fall in a circular neighborhood around each output raster cell.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outPointStats = PointStatistics("ca_ozone_pts.shp", "OZONE", 500, 
                                NbrCircle(10000, "MAP"), "SUM")
outPointStats.save("C:/sapyexamples/output/pointstatsout")
PointStatistics example 2 (stand-alone script)

This example determines a statistic (the average) on the input shapefile point features that fall in a circular neighborhood around each output raster cell.

# Name: PointStatistics_Ex_02.py
# Description: Calculates a statistic on points over a specified 
#    neighborhood outputting a raster.
# 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"
field = "OZONE"
cellSize = 500
neighborhood = NbrCircle(6000, "MAP")

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute PointStatistics
outPointStatistics = PointStatistics(inPointFeatures, field, cellSize,
                                     neighborhood, "MEAN")

# Save the output 
outPointStatistics.save("C:/sapyexamples/output/pointstatout")

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Requires Spatial Analyst
ArcGIS for Desktop Standard: Requires Spatial Analyst
ArcGIS for Desktop Advanced: Requires Spatial Analyst
11/8/2012