The Calculate Density task 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.
For point input, each point should represent the location of some event or incident, and the result layer represents a count of the incident per unit area. A higher density value in a new location means that there are more points near that location. In many cases, the result layer can be interpreted as a risk surface for future events. For example, if the input points represent locations of lightning strikes, the result layer can be interpreted as a risk surface for future lightning strikes.
For line input, the line density surface represents the total amount of line that is near each location. The units of the calculated density values are the length of line per unit area. For example, if the lines represent rivers, the result layer will represent the total length of rivers that are within the search radius. This result can be used to identify areas that are hospitable to grazing animals.
Other use cases of this tool include the following:
- Creating crime density maps to help police departments properly allocate resources to high crime areas.
- Calculating densities of hospitals within a county. The result layer will show areas with high and low accessibility to hospitals, and this information can be used to decide where new hospitals should be built.
- Identifying areas that are at high risk of forest fires based on historical locations of forest fires.
- Locating communities that are far from major highways in order to plan where new roads should be constructed.
Request URL
http://<analysis url>/CalculateDensity/submitJob
Request Parameters
Parameter | Description |
---|---|
inputLayer (Required) | The point or line features from which to calculate density. Syntax: As described in detail in the Feature input topic, this parameter can be one of the following:
Examples:
|
field | A field specifying the number of incidents at each location. For example, if you have points that represent cities, you can use a field representing the population of the city as the count field, and the resulting population density layer will calculate larger population densities near cities with larger populations. If not specified, each location will be assumed to represent a single count. |
cellSize | This value is used to create a mesh of points where density values are calculated. The default is approximately 1/1000th of the smaller of the width and height of the analysis extent as defined in the context parameter. The smaller the value, the smoother the polygon boundaries will be. Conversely, with larger values, the polygon boundaries will be more coarse and jagged. |
cellSizeUnits | The units of the cellSize value. You must provide a value if cellSize has been set. Values: Miles | Feet | Kilometers | Meters Example: "cellSizeUnits": "Meters" |
radius | A distance specifying how far to search to find point or line features when calculating density values. For example, if you provide a search distance of 10,000 meters, the density of any location in the output layer is calculated based on features that are within 10,000 meters of the location. Any location that does not have any incidents within 10,000 meters will receive a density value of zero. If no distance is provided, a default will be calculated that is based on the locations of the input features and the values in the count field (if a count field is provided). Example: "radius": "10" |
radiusUnits | The units of the radius parameter. You must provide a value if radius has been set. Values: Miles | Feet | Kilometers | Meters The default is based on the units specified in your profile and will be either Miles or Kilometers. Example: "radiusUnits": "Kilometers" |
boundingPolygonLayer | A layer specifying the polygon(s) where you want densities to be calculated. For example, if you are interpolating densities of fish within a lake, you can use the boundary of the lake in this parameter and the output will only draw within the boundary of the lake. Syntax: As described in detail in the Feature input topic, this parameter can be one of the following:
|
areaUnits | The units of the calculated density values. Values: SquareMiles | SquareKilometers The default is based on the units specified in your profile and will be either SquareMiles or SquareKilometers. Example: "areaUnits": "SquareMiles" |
classificationType | Determines how density values will be classified into polygons. Values:
The default is EqualInterval. Example: "classificationType": "NaturalBreaks" |
numClasses | This value is used to divide the range of predicted values into distinct classes. The range of values in each class is determined by the classificationType parameter. Each class defines the boundaries of the result polygons. The default is 10. The maximum is 32. Example: "numClasses": "15" |
outputName | If provided, the task will create a feature service of the results. You define the name of the service. If an outputName value is not provided, the task will return a feature collection. Syntax: Syntax: |
context | The Context parameter contains the following additional settings that affect task operation:
Syntax:
|
f | The response format. The default response format is html. Values: html | json |
Response
When you submit a request, the service assigns a unique job ID for the transaction.
{
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
}
After the initial
request is submitted you can use the
jobId to periodically check the status of the job and messages as described in the topic Checking job status.
Once the job has successfully completed, you use
the jobId to retrive the results. To track the status, you can make a request of the following form:http://<analysis url>/CalculateDensity/jobs/<jobId>
Accessing results
When the status of the job request is esriJobSucceded, you can access the results of the analysis by making a request of the following form:http://<analysis url>/CalculateDensity/jobs/<jobId>/results/<output parameter name>?token=<your token>&f=json
Parameter | Description |
---|---|
resultLayer |
The polygon features representing density. Each polygon will surround predicted values based on the classificationType and numClasses. The result has the following fields, where <unit> is based on the areaUnits parameter, and will either be SquareMile or SquareKilometer:
The result has properties for parameter name, data type, and value. The contents of value depends upon the outputName parameter provided in the initial request.
See Feature Output for more information about how the result layer or collection is accessed. |