Apply Layout (Network Diagram service)

Description

The applyLayout operation is performed on a Diagram resource. The result of this operation is a Diagram JSON Information object, and the moment (date) the applyLayout operation happens for a stored diagram.

It is used to apply a specific diagram algorithm on all or parts of the resource diagram content.

Dive-inDive-in:

Starting with ArcGIS Enterprise 11.1, the operation can be run as an asynchronous process—async=true. In this case, it uses the system UtilityNetworkTools geoprocessing service which is reserved for utility network geoprocessing tasks and has a longer default timeout setting.

LicenseLicense:
The active portal account must be licensed with the ArcGIS Utility Network user type extension or the ArcGIS Trace Network user type extension to use this operation.

Request Parameters

Parameter

Details

gdbVersion

Description: The name of the geodatabase version.

Syntax: gdbVersion=<version>

Example: gdbVersion=ABV1

sessionId

Description: The token (guid) used to lock the version.

Syntax: sessionId=<guid>

Example: sessionId=44G259DE-87B0-407D-8F2E-DCB7665DD0F0

layoutName

Required

Description: The name of the algorithm layout to apply (string)

Syntax: layoutName = <AngleDirectedDiagramLayout | CompressionDiagramLayout | ForceDirectedDiagramLayout | GeoPositionsDiagramLayout | GridDiagramLayout | LinearDispatchDiagramLayout | MainLineTreeDiagramLayout | MainRingDiagramLayout | PartialOverlappingEdgesDiagramLayout | RadialTreeDiagramLayout | RelativeMainlineDiagramLayout | ReshapeEdgesDiagramLayout | RotateTreeDiagramLayout | SeparateOverlappingEdgesDiagramLayout | SmartTreeDiagramLayout | SpatialDispatchDiagramLayout >

Example: layoutName = ForceDirectedDiagramLayout

layoutParams

Description: The algorithm layout parameters property set.

There is a specific property set JSON object for each diagram layout parameters

Syntax:

layoutParams = {
 "type": "PropertySet",
 "propertySetItems": ["algoParamName1", , …, "algoParamNameN",]
}

Example:

Sample of parameter property set when layoutName = ForceDirectedDiagramLayout

layoutParams = {
   "type": "PropertySet",
   "propertySetItems": [
    "are_containers_preserved",
    false,
    "is_active",
    false,
    "iterations_number",
    20,
    "repel_factor",
    1,
    "degree_freedom",
    1
   ]
  }

junctionObjectIDs

Description: For the case you want the layout algorithm to apply to a diagram part, a list of junction ObjectIDs (long) that will be processed:

Syntax: junctionObjectIDs=[<DiagJctOid1>, …, <DiagJctOidN]

Example: junctionObjectIDs=[1,2,3,4,5]

containerObjectIDs

Description: For the case you want the layout algorithm to apply to a diagram part, a list of container ObjectIDs (long) that will be processed:

Syntax: containerObjectIDs=[<DiagConOid1>, …, <DiagConOidN]

Example: containerObjectIDs=[1]

edgeObjectIDs

Description: For the case you want the layout algorithm to apply to a diagram part, a list of edge ObjectIDs (long) that will be processed:

Syntax: edgeObjectIDs=[<DiagEdgOid1>, …, <DiagEdgOidN]

Example: edgeObjectIDs=[1,2,3]

async

Added in 10.7.1

Description: Specifies whether the layout algorithm will run synchronously or asynchronously (Boolean).

  • false— The layout algorithm will run synchronously and can fail if the process completion exceeds the service timeout—600 seconds by default. This is the default.
  • true— The layout algorithm will run asynchronously. This option dedicates server resources to run the layout algorithm with a longer time-out. Running asynchronously can be interesting when applying layout that are time consuming—for example, Partial Overlapping Edges—and applying to large diagrams—more than 25,000 features.

Syntax: async=<true | false>

Example: async=true

f

Description: The response format. The default response format is html.

Values: <html | json>

Example Usage

Applying the SmartTree layout algorithm with its default parameters on the entire DiagramTest2 diagram resource content; this diagram being stored in version ABV1; that is:

JSON Response Syntax

A JSON object composed of a Diagram JSON Information object and a moment: {"diagramInfo": Diagram JSON Information, "moment": <moment>}

NoteNote:

The moment is only returned for a stored diagram.

JSON Response Example

Sample response when synchronously applying a layout

{
 "diagramInfo": {
  "tag": "",
  "isStored": true,
  "canStore": false,
  "canExtend": true,
  "isSystem": false,
  "creator": "acb7352",
  "creationDate": 1505145950000,
  "lastUpdateBy": "acb7352",
  "lastUpdateDate": 1505215730000,
  "containerMargin": 0.5,
  "junctionCount": 10,
  "edgeCount": 12,
  "containerCount": 0,
  "aggregationCount": 0,
  "isHistorical": false,
  "access": "esriDiagramPublicAccess",
  "diagramExtent": {
   "xmin": 6807604.6431991458,
   "ymin": 1848131.8394459635,
   "xmax": 6807794.5801552236,
   "ymax": 1848226.8080880493,
   "spatialReference": {
    "wkid": 3498,
    "latestWkid": 3498
   }
  },
  "networkExtent": {
   "xmin": 6807604.6431991458,
   "ymin": 1847967.7367558032,
   "xmax": 6808661.8976463079,
   "ymax": 1848650.1848659664,
   "spatialReference": {
    "wkid": 3498,
    "latestWkid": 3498
   }
  },
  "name": "DiagramTest2",
  "id": "{856490C7-ED84-44FE-8EC8-5DA4B39365C0}",
  "template": "Basic"
 },
 "moment": 1505217369240
}

Sample response when asynchronously applying a layout; that is with async=true

{
 "statusUrl": "https://myserver.esri.com/server/rest/services/Naperville/UtilityNetworkServer/jobs/j03f449a0ece143f1bfc6cc676e3c4cca"
}