Create Buffers

Create Buffers

The Create Buffers task creates polygons that cover a given distance from a point, line, or polygon feature. Buffers are typically used to create areas that can be further analyzed using a tool such as Overlay Layers. For example, if the question is "What buildings are within one mile of the school?", the answer can be found by creating a one-mile buffer around the school and overlaying the buffer with the layer containing building footprints. The end result is a layer of those buildings within one mile of the school.

Request URL

http://<analysis url>CreateBuffers/submitJob

Request Parameters

ParameterDescription

inputLayer

(Required)

The point, line, or polygon features to be buffered.

Syntax: As described in detail in the Feature Input topic, this parameter can be

  • a URL to a feature service layer with an optional filter to select specific features, or
  • a feature collection.

Examples:

  • {"url": <feature service layer url>, "filter": <where clause>}
  • {"layerDefinition": {}, "featureSet": {}, "filter": <where clause>}

distances

(Required if Field not provided)

An array of double values to buffer the input features. You must supply values for either the Distances or Field parameter. You can enter a single distance value or multiple values, separating each value with a space. The units of the distance values is suppied by the Units parameter.

Examples:

  • "distances": [4.0]
  • "distances": [4.0, 5.0, 6.0]

field

(Required if distances not provided)

A field on the inputLayer containing a buffer distance. Unlike the distances parameter, multiple distances are not supported on field input.

Example: "field": "Setback"

units

The linear unit to be used with the distance value(s) specified in distances or contained in the field value

Values: Meters | Kilometers | Feet | Miles | NauticalMiles | Yards

The default is Meters

Example: "units": "Miles"

dissolveType

Determines how overlapping buffers are processed.

Values: None | Dissolve

None (default)

None—Overlapping areas are kept. This is the default.

Dissolve

Dissolve—Overlapping areas are combined.

Example: "dissolveType": "Dissolve"

ringType

Determines how multiple-distance buffers are processed.

Values: Disks | Rings

Disks (default)

Disks—buffers are concentric and will overlap. For example, if your distances are 10 and 14, the result will be two buffers, one from 0 to 10 and one from 0 to 14. This is the default.

Rings

Rings—buffers will not overlap. For example, if your distances are 10 and 14, the result will be two buffers, one from 0 to 10 and one from 10 to 14.

Example:"ringType": "Disks"

sideType

When buffering line features, you can choose which side of the line to buffer. Typically, you choose both sides (Full, which is the default). Left and right are determined as if you were walking from the first x,y coordinate of the line (the start coordinate) to the last x,y coordinate of the line (the end coordinate). Choosing left or right usually means you know that your line features were created and stored in a particular direction (for example, upstream or downstream in a river network).

When buffering polygon features, you can choose whether the buffer includes or excludes the polygon being buffered.

Values: Full | Left | Right | Outside

Full (default for line input)

Full—both sides of the line will be buffered. This is the default for line featuress.

Right

Right—only the right side of the line will be buffered.

Left

Left—only the right side of the line will be buffered.

Outside

Outside—when buffering a polygon, the polygon being buffered is excluded in the result buffer.

(default for polygon input)

If sideType not supplied, the polygon being buffered is included in the result buffer. This is the default for polygon features.

Example: "sideType": "Outside"

endType

The shape of the buffer at the end of line input features. This parameter is not valid for polygon input features. At the ends of lines the buffer can be rounded (Round) or be straight across (Flat).

Values: Round | Flat

Round (default)

Round—buffers will be rounded at the ends of lines. This is the default.

Flat

Flat—buffers will be flat at the ends of lines.

Example: "endType": "Flat"

outputName

If provided, the task will create a feature service of the results. You define the name of the service. If outputName is not supplied, the task will return a feature collection.

Syntax:
{
  "serviceProperties": {
    "name": "<service name>"
  }
}

context

Context contains additional settings that affect task execution. For Create Buffers, there are two settings.

  1. Extent (extent)—a bounding box that defines the analysis area. Only those features in the inputLayer that intersect the bounding box will be buffered.
  2. Output Spatial Reference (outSR)—the output features will be projected into the output spatial reference.

Syntax:
{
"extent" : {extent}
"outSR" : {spatial reference}
}

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.

Syntax:
{
"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>/CreateBuffers/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>/CreateBuffers/jobs/<jobId>/results/bufferLayer?token=<your token>&f=json

ParameterDescription

bufferLayer

The buffer polygons.

Example:
{"url": 
"http://<analysis url>/CreateBuffers/jobs/<jobId>/results/bufferLayer"}

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.

  • If outputName was provided, value contains the url to the feature service layer.

    {
    "paramName":"bufferLayer", 
    "dataType":"GPString",
    "value":{"url":"<hosted featureservice layer url>"}
    }

  • If outputName was not provided, value contains a feature collection.

    {
    "paramName":"bufferLayer",
    "dataType":"GPString",
    "value":{"layerDefinition": {}, "featureSet": {}  }
    }

See Feature Output for more information about how the result layer or collection is accessed.