Point Density (Spatial Analyst)

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

Usage

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 may be integer or floating point.

The options and default behaviours 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 Shape if input features contains 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, this is used by default. The "xxxx" can be any valid character, such as POPULATION6, POPULATION1974, or POPULATIONROADTYPE.
    • If there is no POPULATION field or POPULATIONxxxx field, but there is a POP field, this is used by default.
    • If there is no POPULATION field, POPULATIONxxxx field, or POP field, but there is a POPxxxx field, this is used by default.
    • If there is no POPULATION field, POPULATIONxxxx field, POP field, or POPxxxx field, NONE is used by default.
Field
cell_size
(Optional)

The cell size for the output raster dataset.

This is the value in the environment if specifically set. If the environment is not set, then cell size is the shorter of the width or height of the output extent in the output spatial reference, divided by 250.

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 ({inner_radius}, {outer_radius}, {CELL | MAP})

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

  • NbrCircle ({radius}, {CELL | MAP})

    A circular neighborhood with the given radius.

  • NbrRectangle ({width}, {height}, {CELL | MAP})

    A rectangular neighborhood with the given width and height.

  • NbrWedge ({radius}, {start_angle}, {end_angle}, {CELL | MAP})

    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.

  • {CELL | MAP}

    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 desired area units of the output density values.

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

For example, if your input units are meters the default output area density units will be square kilometers for point features or kilometers per square kilometer for polyline features.

The default density units based on the input feature units are:

  • SQUARE_MAP_UNITS If the units are unknown, points, or decimal degrees.
  • SQUARE_MILES For feet, yards, miles, or nautical miles.
  • SQUARE_KILOMETERS For meters or kilometers.
  • SQUARE_INCHES For inches.
  • SQUARE_CENTIMETERS For centimeters.
  • SQUARE_MILLIMETERS For 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, 2500)
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
# Author: ESRI

# 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
searchRadius = 2500

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

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

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

Environments

Related Topics

Licensing Information

ArcView: Requires Spatial Analyst
ArcEditor: Requires Spatial Analyst
ArcInfo: Requires Spatial Analyst

6/29/2011