Generate Diagram

Description

The generateDiagram operation is performed on a schematic diagram template resource. The result of this operation is a Schematic Diagram Information Object. It is used to generate a new diagram.

NoteNote:

Schematics services published without the Editing operation enabled don't support the generateDiagram operation. Moreover, the generateDiagram operation is only supported on schematic diagram templates when canGenerate=True; that is, when the published map references the schematic diagram template layer.

You can provide arguments to the generateDiagram operation as query parameters defined in the parameters table below.

Request Parameters

Parameter

Details

f

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

Values: html | json

name

Required

Description: The diagram name.

Syntax: name=<diagramName>

Example: name=MyTestDiagram

user

Required

Description: The diagram creator.

Syntax: user=<diagramCreator>

Example: user=NCA3885

folderID

Description: The ID of the folder in which the generated diagram will be stored.

This parameter is optional. If it is not specified, the generated diagram is stored at the schematic dataset root.

Syntax: folderID=<diagramFolderID>

Example: folderID=1

builderContext

Required

Description: The context for the builder which updates the diagram.

This parameter syntax depends on the diagram builder:

  • Diagrams based on the Standard builder that are generated from a set of GIS features/objects

    In that case, the operation expects the lists of the input GIS feature/object IDs per feature class/object table, and those features/objects version:

    Syntax:

    builderContext={
      //The lists of the input GIS feature/object IDs per feature class/object table from which the diagram must be generated
      "initialObjects": [
        {
          "objectClassName" : "<objectClass1Name>",
          "objectIDs" : [ID11, ..., IDN] 
        },
        ...,
        {
          "objectClassName" : "<objectClassNName>",
          "objectIDs" : [ID1, ..., IDM] 
        }
      ],
      //The SDE database reference version for those input GIS features/objects
      "version": "<version>"
    }
    

    Example:

    builderContext={"initialObjects": [{"objectClassName": "PipelinesDatabase.SDE.pug_PUG_gas_plants", "objectIDs": [3]}], "version":"sde.DEFAULT"}

    NoteNote:

    The version parameter is mandatory. We recommend to specify the version when you work with GIS features/objects stored in geodatabases. For this case, when specifying no version, the version used is the one configured on the Associated Object Class section of the Properties tab that displays for the associated schematic feature class when you edit the schematic dataset within Schematic Dataset Editor.

    TipTip:
    When generating a schematic diagram based on the Standard builder from a set of GIS features that compose a geometric network or network dataset, if the Standard builder properties are configured with the Add connected nodes option enabled, you can provide only the list of edge/line features.
  • Diagrams based on the Standard builder that are entirely built from custom queries

    In that case, the operation expects an empty list of initial objects:

    Syntax:

    builderContext={"initialObjects": []}

    Example:

    builderContext={"initialObjects": []}

  • Diagrams based on the XML builder

    In that case, the operation expects the input XML data directly as a string.

    Syntax: builderContext=<XMLData>

    Example:

    builderContext=<Diagrams>
    	<Diagram DiagramTemplateName="SimpleXML">
    	<Features>
    	<NodeFeature>
    	<FeatureClassName>StationsFeeder1</FeatureClassName>
    	<ExternalUniqueID>NS1</ExternalUniqueID>
    	<InitialX>120067.5</InitialX>
    	<InitialY>4070755.8</InitialY>
    	</NodeFeature>
    	<NodeFeature>
    	<FeatureClassName>StationsFeeder1</FeatureClassName>
    	<ExternalUniqueID>NS2</ExternalUniqueID>
    	<InitialX>120090.5</InitialX>
    	<InitialY>4070788.8</InitialY>
    	</NodeFeature>
    	<LinkFeature>
    	<FeatureClassName>LV_Lines</FeatureClassName>
    	<ExternalUniqueID>LV1</ExternalUniqueID>
    	<FromNode>NS1</FromNode>
    	<ToNode>NS2</ToNode>
    	</LinkFeature>
    	</Features>
    	</Diagram>
    	</Diagrams>
    

Example Usage

The map used to publish the S1_Schematics Schematics service referenced the MainNetwork schematic diagram template layer. This template is based on the Standard builder and works from input GIS features organized into a geometric network.

Since this sample service was published without the Editing operation enabled, the generateDiagram operation is not supported. But, with the Editing operation enabled, you could generate a TestDiagram schematic diagram based on this template (id=2) from a set of PrimaryLine geometric network edge features; for example, {"initialObjects": [{"objectClassName": "PrimaryLine", "objectIDs": [1,2,3,4,5,6,178,179,460,555,973,1537,1809,1810,1972,17973,2292,2293,2321,2322,2323,2324,2326,2627]}]}, by executing the operation as follows:

http://servicesbeta6.esri.com/arcgis/rest/services/S1_Schematics/MapServer/exts/SchematicsServer/templates/2/generateDiagram?name=DiagramTest&folderID=&builderContext=%7B%22initialObjects%22%3A+%5B%7B%22objectClassName%22%3A+%22PrimaryLine%22%2C+%22objectIDs%22%3A+%5B1%2C2%2C3%2C4%2C5%2C6%2C178%2C179%2C460%2C555%2C973%2C1537%2C1809%2C1810%2C1972%2C17973%2C2292%2C2293%2C2321%2C2322%2C2323%2C2324%2C2326%2C2627%5D%7D%5D%7D&user=Me&f=pjson

JSON Response Syntax

{
   "name" : "<diagramName>",
   "id" : "<diagramId>",
   "templateIdentifier" : "<templateIdentifier>",
   "templateObjectID" : <templateObjectID>,
   "schematicLayerIdentifier" : <schematicLayerIdentifier>,
   "folderObjectID" : <folderObjectID>,
   "folderIdentifier" : "<folderIdentifier>",
   "objectID" : <objectID>,
   "createdBy" :  "<diagramCreator>",
   "lastModificationBy" : "<diagramLastEditor>",
   "lastUpdateBy" : "<diagramLastUpdator>",
   "creationDate" : "<diagramCreationDate>",
   "lastModificationDate" : "<diagramModificationDate>",
   "lastUpdateDate" : "<diagramLastUpdateDate>",
   "lockedBy" : "<diagramLastLocker>",
   "version" : "<version>",
   "extent" : <envelope>,
   "rootNodes" : ["<rootNode1>" , ..., "<rootNodeN>"],
   "endNodes" : ["<endNode1>" , ..., "<endNodeK>"]
}

JSON Response Example

{
  "name": "DiagramFrom_pug_PUG_gas_plants_ID3",
   "id": "0-5",
   "templateIdentifier": "0",
   "templateObjectID": 892,
   "schematicLayerIdentifier": 0,
   "folderObjectID": -2,
   "folderIdentifier": "-2",
   "objectID": 5,
   "createdBy": "NCA3885",
   "lastModificationBy": "NCA3885",
   "lastUpdateBy": "",
   "creationDate": "05/13/11 14:13:57",
   "lastModificationDate": "05/13/11 14:13:57",
   "lastUpdateDate": "",
   "lockedBy": "",
   "version": "sde.DEFAULT",
   "extent": {
     "xmin": -37.342619999999989,
     "ymin": -11.398460000000886,
     "xmax": -37.342179999999097,
     "ymax": -11.398019999999997,
     "spatialReference": {
      "wkid": 4326,
      "latestWkid": 4326
     }
   }
}

9/13/2017