CalculateDensity

Title  CalculateDensity

Summary

Creates a density map from point or line features by spreading known quantities of some phenomenon (represented as attributes of the points or lines) across the map. The result is a layer of areas classified from least dense to most dense.


Illustration

Calculate Density tool Calculate Density tool

Usage


Syntax

Parameter Explanation
inputPointOrLineFeatures

The input point or line features that will be used to calculate the density raster.

outputName

The name of the output raster service.

The default name is based on the tool name and the input layer name. If the layer already exists, you will be prompted to provide another name.

countField (Optional)

Provide a field indicating the number of incidents at each location. For example, if you are making a population density raster, and the input points are cities, it would be appropriate to use the population of the city for the count field so cities with larger populations have more impact on the density calculations.

searchDistance (Optional)

Choose the search distance and units for the distance. When calculating the density of a cell, all features within this distance will be used in the density calculation for that cell.

The units can be Kilometers, Meters, Miles, or Feet.

The default units are Meters.

outputAreaUnits (Optional)

Choose the area units. Density is count divided by area, and this parameter sets the units of the area in the density calculation.

  • Square Meters—Calculate the density per square meter.
  • Square Kilometers—Calculate the density per square kilometer.
  • Square Feet—Calculate the density per square foot.
  • Square Miles—Calculate the density per square mile.
outputCellSize (Optional)

Set the cell size and units for the output raster.

The units can be Kilometers, Meters, Miles, or Feet.

The default units are Meters.

inBarriers (Optional)

context (Optional)

Code Samples

CalculateDensity example 1 (Python window)

This example creates a density image service raster from points with a population field.


import arcpy

arcpy.CalculateDensity_ra('https://MyPortal.esri.com/server/rest/services/Hosted/myPoints/FeatureServer/0',
                          'outImgServ', 'Population','150000 Meters', 'Square Kilometers','10000 Meters')

                    

CalculateDensity example 2 (stand-alone script)

This example creates a density image service raster from points with a population field.


#-------------------------------------------------------------------------------
# Name: CalculateDensity_example02.py
# Description: Creates a density image service raster from points with a population.
#
# Requirements: ArcGIS Image Server

# Import system modules
import arcpy

# Set local variables
inPoints = 'https://MyPortal.esri.com/server/rest/services/Hosted/myPoints/FeatureServer/0'
outRaster = 'outImgServ'
inField = 'Population'
searchDistance = '150000 Meters'
areaUnit = 'Square Kilometers'
outCellSize = '10000 Meters'

# Execute CalculateDensity
arcpy.CalculateDensity_ra(inPoints, outRaster, inField, searchDistance, areaUnit, outCellSize)

                    

Tags

Credits

Use limitations