Skip To Content ArcGIS for Developers Sign In Dashboard

Optimal Region Connections

Description

Optimal Region Connections diagram

The OptimalRegionConnections task calculates the optimal connectivity network between two or more input regions.

The focus of OptimalRegionConnections is to define the optimum connections of least-cost paths between regions. On the resulting connections, the phenomenon can move from one region to any other region using the paths (possibly traveling through other regions).

The input to OptimalRegionConnections must be regions. A region is a connected series of cells (adjacent) with the same value. If you have disconnected cells with the same value, they are zones. Using zones as input to this task is not recommended. Optimal Region Connections connects every region to every other region, so all regions, and all cells in the regions, can be reached through the result.

Example applications

Example applications of this service include the following:

  • Suitability modeling

    From a suitability model, you have identified 10 of the best habitat patches for bobcats. You want the bobcats to move between the patches through the most effective network of wildlife corridors to maintain genetic diversity within the metapopulation.

  • Timber harvest

    In a timber harvest, you want to create the most cost-efficient network of logging roads from which to extract the lumber.

  • Peacekeeping

    In a military peacekeeping deployment, you have identified five areas at which to position troops and personnel. You want to develop the optimally connected supply routes between the bases.

Request parameters

ParameterDetails
inputRegionsRasterOrFeatures

(Required)

The input regions that are to be connected by the least-cost network. Regions can be defined by either an image service or a feature service.

Syntax: This parameter can have either a raster input or a feature input. For raster input, this parameter can be specified as a portal item ID, a URL to a raster image service layer, a cloud raster dataset, or a shared raster dataset. For feature input, this parameter can be specified as either a URL to a feature service layer or a feature collection.

Raster input examples:

//Portal item as input raster
"inputRegionsRasterOrFeatures":{"itemId": <portal item id>}

//URL as input raster
"inputRegionsRasterOrFeatures":{"url":<image service layer url>}

Feature input examples:

//Feature layer URL
"inputRegionsRasterOrFeatures":{"url": <feature service layer url>}

//Feature collection
"inputRegionsRasterOrFeatures":{"layerDefinition": {}, "featureSet": {}}

outputOptimalLinesName

(Required)

The name of the output line feature service that connects each input region.

Each path (or line) is uniquely numbered, and additional fields in the attribute table store specific information about the path. Those additional fields are the following:

  • PATHID—The unique identifier for the path
  • PATHCOST—The total accumulative distance or cost for the path
  • REGION1—The first region the path connects
  • REGION2—The other region the path connects

This information provides insight into the paths within the network.

Since each path is represented by a unique line, there will be multiple lines in locations where paths travel the same route.

The task will create a feature service of the results. You can define the name of the service.

Output feature service examples:

//REST web example
myOutput

//REST scripting example
"outputOptimalLinesName" : "myOutput1"

inputBarrierRasterOrFeatures

The layer that defines the barriers to calculate the back direction around.

The barriers can be defined by an integer or a floating-point image service, or by a feature service.

For an image service barrier, the barrier must have a valid value, including zero, and the areas that are not barriers must be NoData.

Raster input examples:

//Portal item as input raster
"inputBarrierRasterOrFeatures":"itemID": <portal item id>}

//URL as input raster
"inputBarrierRasterOrFeatures":{"url": <image service layer url>}

//Cloud raster as input raster
"inputBarrierRasterOrFeatures": {"uri": <cloud raster dataset uri>}

Feature input examples:

//Feature layer URL
"inputBarrierRasterOrFeatures":{"url": 
<feature service layer url>}

//Feature collection
"inputBarrierRasterOrFeatures":{"layerDefinition": {}, "featureSet": {}}

inputCostRaster

A raster defining the impedance or cost to move planimetrically through each cell.

The value at each cell location represents the cost-per-unit distance for moving through the cell. Each cell location value is multiplied by the cell resolution while also compensating for diagonal movement to obtain the total cost of passing through the cell.

Syntax: This parameter can be specified as a portal item ID, a URL to a raster image service layer, a cloud raster dataset, or a shared raster dataset.

Examples:

//Portal item as input raster
"inputCostRaster": {"itemId": <portal item id>}

//URL as input raster
"inputCostRaster": {"url": <image service layer url>}

outputNeighborConnectionsName

The task will create a feature service of the results. You can define the name of the service.

Output feature service examples:

//REST web example
myOutput

//REST scripting example
"outputNeighborConnectionsName" : "myOutput2"

distanceMethod

Determines whether to calculate the distance using a planar (flat earth) or a geodesic (ellipsoid) method.

  • PLANAR: The calculation will be performed on a projected flat plane using a 2D Cartesian coordinate system. This is the default method.
  • GEODESIC: Distances are calculated on the ellipsoid. Therefore, regardless of input or output projection, the results do not change.
connectionsWithinRegions

Specifies whether the paths will continue and connect within the input regions.

  • GENERATE_CONNECTIONS: Paths will continue within the input regions to connect all paths that enter a region.
  • NO_CONNECTIONS: Paths will stop at the edges of the input regions and will not continue or connect within them.
context

Contains additional settings that affect task execution. This task has the following settings:

  • Extent (extent): A bounding box that defines the analysis area.
  • Output Spatial Reference (outSR): The output raster will be projected into the output spatial reference.
  • Snap Raster (snapRaster): The output raster will have its cells aligned with the specified snap raster.
  • Cell Size (cellSize): The output raster will have the resolution specified by cell size.
  • Mask (mask): Only cells that fall within the analysis mask will be considered in the operation.
f

The response format. The default response format is html.

Values: html | json | pjson

Response

When you submit a request, the task 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 Checking job status. Once the job has successfully completed, you use the jobId to retrieve the results. To track the status, you can make a request of the following form:

https://<raster analysis tools url>/OptimalRegionConnections/jobs/<jobId>

When the status of the job request is esriJobSucceeded, you can access the results of the analysis by making a request of the following form:

https://<raster analysis tools url>/OptimalRegionConnections/jobs/<jobId>/results/<output parameter>

Example usage

Below is a sample request URL for OptimalRegionConnections.

https://services.myserver.com/arcgis/rest/services/System/RasterAnalysisTools/GPServer/OptimalRegionConnections/submitJob

JSON response example

The response returns the outputOptimumNetworkFeatures and outputNeighborConnectionsFeatures output parameters, which have properties for parameter name, data type, and value. The content of value depends on the outputOptimalLinesName and outputNeighborConnectionsFeatures parameters provided in the initial request, affecting the output parameters, respectively. For example, if the outputOptimalLinesName parameter is provided, the value for outputOptimumNetworkFeatures will contain the feature service layer URL. If it was not included in the request, the value will contain a feature collection.

Network name included in request example:

{
  "paramName":"resultLayer",
  "dataType":"GPString",
  "value":{"url":"<hosted feature service layer url>"
}

Network name not included in request example:

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