Apply Layout

URL:
https://<root>/<serviceName>/NetworkDiagramServer/diagrams/<diagramName>/applyLayout
Methods:
POST
Version Introduced:
10.6

Description

The applyLayout operation applies a specific diagram algorithm to a diagram or parts of a diagram. It is performed on a Diagram resource. The result of this operation is a Diagram JSON Information object, and the moment (date) the operation happens for a stored diagram.

Request Parameters

ParameterDetails

gdbVersion

The name of the geodatabase version.

Syntax: gdbVersion=<version>

Example: gdbVersion=ABV1

sessionId

The token (guid) used to lock the version.

Syntax: sessionId=<guid>

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

layoutName


(Required)

The name of the algorithm layout to apply (string). The parameter accepts the following values:

Example: layoutName = ForceDirectedDiagramLayout

layoutParams

The algorithm layout parameters property set.

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

Syntax:

Use dark colors for code blocksCopy
1
2
3
4
layoutParams = {
 "type": "PropertySet",
 "propertySetItems": ["algoParamName1", <algoParamValue1>, …, "algoParamNameN",<algoParamValueN>]
}

Example:

Sample of parameter property set when layoutName = ForceDirectedDiagramLayout

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
layoutParams = {
   "type": "PropertySet",
   "propertySetItems": [
    "are_containers_preserved",
    false,
    "is_active",
    false,
    "iterations_number",
    20,
    "repel_factor",
    1,
    "degree_freedom",
    1
   ]
  }

junctionObjectIDs

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

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

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

A boolean statement that specifies whether the layout algorithm will run synchronously or asynchronously.

  • 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

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:

  • URL: https://myserver.esri.com/server/rest/services/Naperville/NetworkDiagramServer/diagrams/DiagramTest2/applyLayout

  • Parameters:

    Use dark colors for code blocksCopy
    1
    2
    3
    4
    5
    6
    7
    8
    9
    gdbVersion=ABV1
    sessionId=
    layoutName=SmartTreeDiagramLayout
    layoutParams=
    junctionObjectIDs=
    containerObjectIDs=
    edgeObjectIDs=
    async=
    f=pjson
  • Sent URL (GET): https://myserver.esri.com/server/rest/services/Naperville/NetworkDiagramServer/diagrams/DiagramTest2/applyLayout?gdbVersion=ABV1&sessionId=&layoutName=SmartTreeDiagramLayout&layoutParams=&junctionObjectIDs=&containerObjectIDs=&edgeObjectIDs=&async=&f=pjson

JSON Response Syntax

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

JSON Response Example

Sample response when synchronously applying a layout

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
 "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

Use dark colors for code blocksCopy
1
2
3
{
 "statusUrl": "https://myserver.esri.com/server/rest/services/Naperville/UtilityNetworkServer/jobs/j03f449a0ece143f1bfc6cc676e3c4cca"
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.