Point Density (Spatial Analyst)

Available with Spatial Analyst license.

Summary

Calculates a magnitude-per-unit area from point features that fall within a neighborhood around each cell.

Learn more about how Point Density works

Illustration

Point Density illustration
OutRas = PointDensity(InPts, None, 30)

Usage

  • Only the points that fall within the neighborhood are considered when calculating the density. If no points fall within the neighborhood at a particular cell, that cell is assigned NoData.

  • The values on the output raster will always be floating point.

  • The Output cell size 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 selected Cell Size Projection Method.

  • Larger values of the radius parameter produce a more generalized density raster. Smaller values produce a raster that shows more detail.

  • For data formats that support Null values, such as file geodatabase feature classes, a Null value will be ignored when used as input.

  • If the area unit scale factor units are small, relative to the distance between the points, the output raster values may be small. To obtain larger values, use the area unit scale factor for larger units (for example, square kilometers versus square meters).

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

Syntax

PointDensity(in_point_features, population_field, {cell_size}, {neighborhood}, {area_unit_scale_factor})
ParameterExplanationData Type
in_point_features

The input point features for which to calculate the density.

Feature Layer
population_field

Field denoting population values for each point. The population field is the count or quantity to be used in the calculation of a continuous surface.

Values in the population field can be integer or floating point.

The options and default behaviors for the field are listed below.

  • Use None if no item or special value will be used and each feature will be counted once.

  • You can use the Shape field if input features contain Z.

  • Otherwise, the default field is POPULATION. The following conditions may also apply:

    • If there is no POPULATION field, but there is a POPULATIONxxxx field, it will be used by default. The xxxx can be any valid characters, for example, POPULATION6, POPULATION1974, and POPULATIONROADTYPE.
    • If there is no POPULATION field or POPULATIONxxxx field, but there is a POP field, it will be used by default.
    • If there is no POPULATION field, POPULATIONxxxx field, or POP field, but there is a POPxxxx field, it will be used by default.
    • If there is no POPULATION field, POPULATIONxxxx field, POP field, or POPxxxx field, NONE will be used by default.
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)

Dictates the shape of the area around each cell used to calculate the density value.

This is a Neighborhood class.

There are four types of neighbourhood class: NbrAnnulus, NbrCircle, NbrRectangle, and NbrWedge.

The forms and descriptions of the classes are:

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

    A torus (donut shaped) neighborhood defined by an inner radius and an outer radius.

  • NbrCircle ({radius}, {units})

    A circular neighborhood with the given radius.

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

    A rectangular neighborhood with the given width and height.

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

    A wedge (pie) shaped neighborhood. A wedge is specified by a start angle, an end angle, and a radius. The wedge extends counterclockwise from the starting angle to the ending angle. Angles are specified in arithmetic degrees (counterclockwise from the positive x-axis). Negative angles may be used.

  • {units}

    Defines the units as either the number of cells or as value in map units.

The default is NbrCircle, where radius is the shortest of the width or height of the output extent in the output spatial reference, divided by 30.

Neighborhood
area_unit_scale_factor
(Optional)

The area units of the output density values.

A default unit is selected based on the linear unit of the output spatial reference. You can change this to the appropriate unit if you want to convert the density output. Values for line density convert the units of both length and area.

If no output spatial reference is specified, the output spatial reference will be the same as the input feature class. The default output density units are determined by the linear units of the output spatial reference as follows. If the output linear units are meters, the output area density units will be set to Square kilometers, outputting square kilometers for point features or kilometers per square kilometers for polyline features. If the output linear units are feet, the output area density units will be set to Square miles.

If the output units is anything other than feet or meters, the output area density units will be set to Square map units. That is, the output density units will be the square of the linear units of the output spatial reference. For example, if the output linear units are centimeters, the output area density units will be Square map units, which will result in square centimeters. If the output linear units are kilometers, the output area density units will be Square map units, which will result in square kilometers.

The available options and their corresponding output density units are the following:

  • SQUARE_MAP_UNITSFor the square of the linear units of the output spatial reference.
  • SQUARE_MILESFor miles (U.S.).
  • SQUARE_KILOMETERSFor kilometers.
  • ACRESFor acres (U.S.).
  • HECTARESFor hectares.
  • SQUARE_YARDSFor yards (U.S.).
  • SQUARE_FEETFor feet (U.S.).
  • SQUARE_INCHESFor inches (U.S.).
  • SQUARE_METERSFor meters.
  • SQUARE_CENTIMETERSFor centimeters.
  • SQUARE_MILLIMETERSFor millimeters.
String

Return Value

NameExplanationData Type
out_raster

The output point density raster.

It is always a floating point raster.

Raster

Code sample

PointDensity example 1 (Python window)

This example calculates a density raster from a point shape file.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
pdensOut = PointDensity("rec_sites.shp", "NONE", 60, NbrCircle(2500, "MAP"))
pdensOut.save("C:/sapyexamples/output/pointdensity")
PointDensity example 2 (stand-alone script)

This example calculates a density raster from a point shape file.

# Name: PointDensity_Ex_02.py
# Description: Calculates a magnitude per unit area from point 
#    features that fall within a neighborhood around each cell.
# 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
inFeatures = "rec_sites.shp"
populationField = "NONE"
cellSize = 60

# Create the Neighborhood Object
radius = 2500
myNbrCirc = NbrCircle(radius, "MAP")

# Execute PointDensity
outPdens = PointDensity(inFeatures, populationField, cellSize, 
                        myNbrCirc, "SQUARE_KILOMETERS")

# Save the output 
outPdens.save("C:/sapyexamples/output/outpdens")

Licensing information

  • Basic: Requires Spatial Analyst
  • Standard: Requires Spatial Analyst
  • Advanced: Requires Spatial Analyst

Related topics