Overlay Layers

Overlay Layers

The Overlay Layers task combines two or more layers into one single layer. You can think of overlay as peering through a stack of maps and creating a single map containing all the information found in the stack. In fact, before the advent of GIS, cartographers would literally copy maps onto clear acetate sheets, overlay these sheets on a light table, and hand draw a new map from the overlaid data. Overlay is much more than a merging of line work; all the attributes of the features taking part in the overlay are carried through to the final product. Overlay is used to answer one of the most basic questions of geography, "what is on top of what?" For example:

  • What parcels are within the 100-year floodplain? (Within is just another way of saying on top of.)
  • What roads are within what counties?
  • What land use is on top of what soil type?
  • What wells are within abandoned military bases?

Request URL

http://<analysis url>/OverlayLayers/submitJob

Request Parameters

ParameterDescription

inputLayer

(Required)

The point, line, or polygon features that will be overlayed with the overlayLayer

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>}

overlayLayer

(Required)

The features that will be overlaid with the inputLayer features.

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>}

overlayType

The type of overlay to be performed.

Values: Intersect | Union | Erase

Intersect

Intersect— Computes a geometric intersection of the input layers. Features or portions of features which overlap in both the inputLayer and overlayLayer layer will be written to the output layer. This is the default.

Union

Union—Computes a geometric union of the input layers. All features and their attributes will be written to the output layer. This option is only valid if both the inputLayer and the overlayLayer contain polygon features.

Erase

Erase— Only those features or portions of features in the overlayLayer that are not within the features in the inputLayer layer are written to the output.

Example: "overlayType": "Union"

outputType

The type of intersection you want to find. This parameter is only valid when the overlayType is Intersect

Values: Input | Line | Point

  • Input - The features returned will be the same geometry type as the inputLayer or overlayLayer with the lowest dimension geometry. If all inputs are polygons, the output will contain polygons. If one or more of the inputs are lines and none of the inputs are points, the output will be line. If one or more of the inputs are points, the output will contain points. This is the default.
  • Line - Line intersections will be returned. This is only valid if none of the inputs are points.
  • Point - Point intersections will be returned. If the inputs are line or polygon, the output will be a multipoint layer.

snapToInput

A Boolean value indicating if feature vertices in the inputLayer are allowed to move. The default is false and means if the distance between features is less than the tolerance value, all features from both layers can move to allow snapping to each other. When set to true, only features in overlayLayer can move to snap to the inputLayer features.

Values: true | false

Example: "snapToInput": true

tolerance

A double value of the minimum distance separating all feature coordinates as well as the distance a coordinate can move in X or Y (or both). The units of tolerance are the same as the units of the inputLayer.

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 Overlay Layers, there are two settings.

  1. Extent (extent)—a bounding box that defines the analysis area. Only those features in the inputLayer and overlayLayer and that intersect the bounding box will be overlaid.
  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>/OverlayLayers/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>/OverlayLayers/jobs/<jobId>/results/outputLayer?token=<your token>&f=json

ParameterDescription

outputLayer

The features that are the result of the overlay. The type of feature (point, line, or polygon) depends on the input parameter settings.

Example:
{"url": 
"http://<analysis url>/OverlayLayers/jobs/<jobId>/results/outputLayer"}

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":"outputLayer", 
    "dataType":"GPString",
    "value":{"url":"<hosted featureservice layer url>"}
    }

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

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

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