Point Statistics (Spatial Analyst)

Summary

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

Learn more about how Point Statistics works

Usage

  • There are several neighborhood shapes and statistic types to choose from. The selection of available statistics depends on the type of the specified field.

  • For integer fields, the valid choices for Statistics type are: majority, maximum, mean, median, minimum, minority, range, standard deviation, sum, and variety. For float fields, the valid statistics are: maximum, mean, minimum, range, standard deviation, and sum. Majority, minority, and variety are not available.

  • If the field type is integer, the output raster will be integer for the following statistics: majority, maximum, median, minimum, minority, range, sum, and variety. The output will be float for the mean and standard deviation statistics.

    If the field type is float, the output raster will be float for all available statistic types.

  • If there are no points in the neighborhood of a raster cell, the Variety statistic assigns it a value of 0. For the other statistics, NoData is assigned.

  • The Output cell size parameter can be defined by a numeric value or obtained from an existing raster dataset. If the cell size hasn’t been explicitly specified as the parameter value, it is derived from the Cell Size environment if it has been specified. If the parameter cell size or the environment cell size have not been specified, but the Snap Raster environment has been set, the cell size of the snap raster is used. If nothing is specified, the cell size is calculated from the shorter of the width or height of the extent divided by 250 in which the extent is in the output coordinate system specified in the environment.

  • If the cell size is specified using a numeric value, the tool will use it directly for the output raster.

    If the cell size is specified using a raster dataset, the parameter will show the path of the raster dataset instead of the cell size value. The cell size of that raster dataset will be used directly in the analysis, provided the spatial reference of the dataset is the same as the output spatial reference. If the spatial reference of the dataset is different than the output spatial reference, it will be projected based on the specified Cell Size Projection Method value.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

Parameters

LabelExplanationData Type
Input point features

The input points to use in the neighborhood operation.

For each output cell, any input points that fall within the defined neighborhood shape around it are identified. For the selected points, values from the specified attribute are obtained, and a statistic is calculated.

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

Feature Layer
Field

The field for which the specified statistic will be calculated. It can be any numeric field of the input point features.

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

Field
Output cell size
(Optional)

The cell size of the output raster that will be created.

This parameter can be defined by a numeric value or obtained from an existing raster dataset. If the cell size hasn't been explicitly specified as the parameter value, the environment cell size value will be used if specified; otherwise, additional rules will be used to calculate it from the other inputs. See the usage section for more detail.

Analysis Cell Size
Neighborhood
(Optional)

The area around each processing cell within which any input points found will be used in the statistics calculation. There are several predefined neighborhood types to choose from.

Once the neighborhood type is selected, other parameters can be set to fully define the shape, size, and units of measure. The default neighborhood is a square rectangle with a width and height of three cells.

The following are the forms of the available neighborhood types:

  • Annulus, Inner radius, Outer radius, Units type

    A ring or donut-shaped neighborhood defined by an inner radius and an outer radius. The minimum value for radius is 1 cell, and the outer radius must be larger than the inner. The maximum inner radius is 2046 cells, and the maximum outer radius is 2047 cells. The default annulus is an inner radius of 1 cell and an outer radius of 3 cells.

  • Circle, Radius, Units type

    A circular neighborhood with the given radius. The minimum value for radius is 1 cell, and the maximum value is 2047 cells. The default radius is 3 cells.

  • Rectangle, Height, Width, Units type

    A rectangular neighborhood defined by width and height. The minimum value for width or height is 1 cell, and the maximum value is 4096 cells. The default is a square with a width and height of 3 cells.

  • Wedge, Radius, Start angle, End angle, Units type

    A wedge-shaped neighborhood defined by a radius, a start angle, and an end angle. The minimum value for radius is 1 cell, and the maximum value is 2047 cells. The wedge extends counterclockwise from the starting angle to the ending angle. Angles are specified in degrees, with 0 or 360 representing east. Negative angles can be used. The default wedge is from 0 to 90 degrees, with a radius of 3 cells.

The distance units for the parameters can be specified in Cell units or Map units. Cell units is the default.

Neighborhood
Statistics type
(Optional)

Specifies the statistic type to be calculated.

The calculation is performed on the values of the specified field of the points that fall within the specified neighborhood of each output raster cell.

The default statistic type is Mean.

The available choices for the statistic type are determined by the numeric type of the specified field. If the field is integer, all the statistics types will be available. If the field is floating point, only the maximum, mean, minimum, range, standard deviation, and sum statistics will be available.

  • MeanThe average of the field values in each neighborhood will be calculated.
  • MajorityThe most frequently occurring field value in each neighborhood will be identified. In the case of a tie, the lower value is used.
  • MaximumThe largest field value in each neighborhood will be identified.
  • MedianThe median field value in each neighborhood will be calculated. In the case of an even number of points in the neighborhood, the result will be the lower of the two middle values.
  • MinimumThe smallest field value in each neighborhood will be identified.
  • MinorityThe least frequently occurring field value in each neighborhood will be identified. In the case of a tie, the lower value is used.
  • RangeThe range (the difference between the largest and smallest) of the field values in each neighborhood will be calculated.
  • Standard DeviationThe standard deviation of the field values in each neighborhood will be calculated.
  • SumThe sum of the field values in the neighborhood will be calculated.
  • VarietyThe number of unique field values in each neighborhood will be calculated.
String

Return Value

LabelExplanationData Type
Output raster

The output point statistics raster.

Raster

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

The input points to use in the neighborhood operation.

For each output cell, any input points that fall within the defined neighborhood shape around it are identified. For the selected points, values from the specified attribute are obtained, and a statistic is calculated.

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

Feature Layer
field

The field for which the specified statistic will be calculated. It can be any numeric field of the input point features.

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

Field
cell_size
(Optional)

The cell size of the output raster that will be created.

This parameter can be defined by a numeric value or obtained from an existing raster dataset. If the cell size hasn't been explicitly specified as the parameter value, the environment cell size value will be used if specified; otherwise, additional rules will be used to calculate it from the other inputs. See the usage section for more detail.

Analysis Cell Size
neighborhood
(Optional)

The area around each processing cell within which any input points found will be used in the statistics calculation. There are several predefined neighborhood types to choose from.

Once the neighborhood type is selected, other parameters can be set to fully define the shape, size, and units of measure. The default neighborhood is a square rectangle with a width and height of three cells.

The shape of the neighborhoods around each input point are defined by the Neighborhood class. The available neighborhood types are NbrAnnulus, NbrCircle, NbrRectangle, and NbrWedge.

The following are the forms of the available neighborhood types:

  • NbrAnnulus({innerRadius}, {outerRadius}, {units})

    A ring or donut-shaped neighborhood defined by an inner radius and an outer radius. The minimum value for radius is 1 cell, and the outer radius must be larger than the inner. The maximum inner radius is 2046 cells, and the maximum outer radius is 2047 cells. The default annulus is an inner radius of 1 cell and an outer radius of 3 cells.

  • NbrCircle({radius}, {units}

    A circular neighborhood with the given radius. The minimum value for radius is 1 cell, and the maximum value is 2047 cells. The default radius is 3 cells.

  • NbrRectangle({width}, {height}, {units})

    A rectangular neighborhood defined by width and height. The minimum value for width or height is 1 cell, and the maximum value is 4096 cells. The default is a square with a width and height of 3 cells.

  • NbrWedge({radius}, {startAngle}, {endAngle}, {units})

    A wedge-shaped neighborhood defined by a radius, a start angle, and an end angle. The minimum value for radius is 1 cell, and the maximum value is 2047 cells. The wedge extends counterclockwise from the starting angle to the ending angle. Angles are specified in degrees, with 0 or 360 representing east. Negative angles can be used. The default wedge is from 0 to 90 degrees, with a radius of 3 cells.

The distance units for the parameters can be specified in CELL units or MAP units. Cell units is the default.

The default neighborhood type is NbrRectangle with a height and width of three cells.

Neighborhood
statistics_type
(Optional)

Specifies the statistic type to be calculated.

The calculation is performed on the values of the specified field of the points that fall within the specified neighborhood of each output raster cell.

  • MEANThe average of the field values in each neighborhood will be calculated.
  • MAJORITYThe most frequently occurring field value in each neighborhood will be identified. In the case of a tie, the lower value is used.
  • MAXIMUMThe largest field value in each neighborhood will be identified.
  • MEDIANThe median field value in each neighborhood will be calculated. In the case of an even number of points in the neighborhood, the result will be the lower of the two middle values.
  • MINIMUMThe smallest field value in each neighborhood will be identified.
  • MINORITYThe least frequently occurring field value in each neighborhood will be identified. In the case of a tie, the lower value is used.
  • RANGEThe range (the difference between the largest and smallest) of the field values in each neighborhood will be calculated.
  • STDThe standard deviation of the field values in each neighborhood will be calculated.
  • SUMThe sum of the field values in the neighborhood will be calculated.
  • VARIETYThe number of unique field values in each neighborhood will be calculated.

The default statistic type is MEAN.

The available choices for the statistic type are determined by the numeric type of the specified field. If the field is integer, all the statistics types will be available. If the field is floating point, only the maximum, mean, minimum, range, standard deviation, and sum statistics will be available.

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")

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

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

Related topics