Generate, update, and display diagrams within ArcGIS Server Schematics


Purpose
This sample demonstrates how to share your schematic diagrams across an enterprise and across the Web using ArcGIS Server. This Web application shows how schematic diagrams can be generated, updated, and displayed using ArcGIS Server Schematics.
 
Note: This sample requires an Advanced ArcGIS Server authorization file. This Advanced authorization file must include the Schematics extension.

How to use

Data has been provided for your use with this sample. It can be found at <Your ArcGIS Developer Kit Install directory>/Samples/data/Schematics/SchematicsForServer.mdf, <Your ArcGIS Developer Kit Install directory>/Samples/data/Schematics/SchematicsForServer.tbx and <Your ArcGIS Developer Kit Install directory>/Samples/data/Schematics/SchematicsForServerSample.mxd.
If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

Sharing sample data
  1. Verify that the Web Application Developer Framework (ADF) for the .NET Framework is installed and functioning properly. For information on installing and configuring the Web ADF, consult the installation guide.
  2. Create a temporary folder on your disk (for example, C:\tmp\Schematics).
  3. In Windows Explorer, navigate to <ArcGIS Developer Kit install location>\Samples\data\Schematics.
  4. Copy the SchematicsForServer.mdf, SchematicsForServer.tbx, and SchematicsForServerSample.mxd files to the C:\tmp\Schematics temporary folder you created in step 2.
  5. Share this Schematics folder and give full control to any user you want to work with the sample Web application data.

Setup access to the geodatabase
  1. You must have access to SQLExpress which has been configured for use with ArcSDE workgroup geodatabases to use the data packaged with the sample.
  2. Assuming you have access to SQLExpress configured for use with ArcSDE workgroup geodatabases, open ArcCatalog; under Database Servers double click Add Database Server and connect to SQLExpress.
  3. Right-click on the SQLExpress instance and select Permissions. Add the ArcGIS Server Container account (ArcGISSOC).
  4. Right-click the SQLExpress instance and select Attach. Navigate to the SchematicsForServer.mdf database sample (e.g. c:\tmp\Schematics\SchematicsForServer.mdf). The SchematicsForServer geodatabase should be added to the geodatabase list for the SQLExpress instance in ArcCatalog.
  5. Right-click on the SchematicsForServer geodatabase and select Administration>Permissions. Grant the ArcGIS Server Container account read/write privileges.

Creating the related database connection file
  1. Right-click on the SchematicsForServer geodatabase and click Save Connection.
  2. Expand the Database Connections entry in Catalog tree. A new .sde connection file should have been created. Its name is "Connection to [localhost]_[sqlexpress]", [sqlexpress] being the SQL server instance name on your [localhost] server name.
  3. Right-click this connection and click Copy.
  4. Navigate to C:\tmp\Schematics in Catalog tree and paste it at this location.
  5. Right-click the entry in Catalog tree and click rename.
  6. Type YourSDEConnection as a new name for this SDE connection file. This is the expected name for the SDE connection file used in the GP models which are provided with this sample.

Verify the sample map document data source references and the geoprocessing sample model parameters
  1. Start ArcMap and load the SchematicsForServerSample.mxd file stored in C:\tmp\Schematics\.
  2. Verify that the data sources specified for the feature layers contained in this MXD file are correctly linked to the SchematicsForServer geodatabase. The layers are organized into four data frames. Feature layers in the GeographicMap data frame are linked to the feature classes stored in the Base_Map and pipelines feature datasets in the SchematicsForServer geodatabase. Schematic layers in the other data frames are linked to diagrams of the schematic dataset stored in the SchematicsForServer geodatabase. Save the changes.
  3. Start ArcCatalog and navigate to C:\tmp\Schematics.
  4. Expand the SchematicsForServer.tbx toolbox. See the following screen shot. This toolbox contains GP models to generate and update GeoSchematic, ISP_GasPlant, or OSP diagrams in the SchematicsForServer geodatabase.
  5. Edit each GP model parameter, verify that each parameter reference is correctly set, and save it if changes were required.


  6. The SchematicsForServer sample toolbox.

Publish the map document
  1. Start ArcGIS Server Object Manager.
  2. Publish the SchematicsForServerSample.mxd file to create a map service. Name this map service in the Web application Schematics_For_Server_Sample.

Publish the toolbox
  1. Publish the SchematicsForServer toolbox to create a GP service and its related GP tasks (Create GeoSchematic Diagram, Create OSP Diagram, Create ISP Diagram, and Update Diagram). Name this GP service in the Web application Schematics_For_Server.

Set up the sample Web application
  1. In Windows Explorer, navigate to <ArcGIS Developer Kit install location>\Samples\ServerNET\ArcGIS_Schematics_ServingDiagrams.
  2. Open the folder of the language you're going to use—CSharp or VBNet—and copy the ArcGIS_Schematics_ServingDiagrams<language> folder to C:\inetpub\wwwroot. The <language> variable can be either CSharp or VBNet.
  3. Open the IIS Manager from Control Panel > Administrative Tools > Internet Information Services (IIS) Manager or Internet Information Services.
  4. In the console tree view on the left, navigate to Local Computer > Web Sites > Default Web Site, expand Default Web Site, right-click the C:\inetpub\wwwroot\ArcGIS_Schematics_ServingDiagrams_[language] folder, and click and click Properties. The Properties dialog box opens.
  5. Click the Directory tab, click the Create button in the Application Settings section, then click OK to close the Properties dialog box.
  6. Start Microsoft Visual Studio 2008 and open the ArcGIS_Schematics_ServingDiagrams_[language] Web site (for example, ArcGIS_Schematics_ServingDiagrams_VBNet or ArcGIS_Schematics_ServingDiagrams_CSharp) located in C:\inetpub\wwwroot\.
  7. In Solution Explorer, right-click Default.aspx and select Set As Start Page.
  8. If necessary, set the run time identity of the Web application by following one of the next two steps. If not necessary, proceed to step 11.
  9. At design time, the identity of the user running Visual Studio is used to connect to an ArcGIS Server local data source. At run time, that identity is established by the Web application. Only one identity can be used to define access to the ArcGIS Server local data sources in a single Web application. This identity can be explicitly defined when building the Web ADF application in Visual Studio by right-clicking the Web project in Solution Explorer and selecting the Add ArcGIS Identity option. Enter the identity credentials that will be used to access ArcGIS Server local resources at run time. This information is added to the web.config file in a standard ASP.NET identity tag. If the Encrypt identity in web.config check box is checked, the identity tag will be encrypted; otherwise, the username and password are stored as clear text.
  10. Open the web.config file, add an <identity> element in <system.web>, set the impersonate attribute to true, and add a username and password attribute and set them to a valid user account. If you're working with ArcGIS Server local data sources, ensure the account has access to the geographic information system (GIS) server resources referenced in the Map control. Other pages in this sample do not require specific changes.
  11. Save the project.
  12. Click Compile.

Run the sample application
  1. Browse to the viewer uniform resource locator (URL) (for example, http://localhost/ArcGIS_Schematics_ServingDiagrams_VBNet/Default.aspx) or start the Web application in Visual Studio 2008.

Display schematic diagrams in the running application
  1. See the Web controls subsection of the Additional information section for information on available Web controls.
  2. GeographicMap is the default item selected in the View Type list. Clicking the Diagram list drop-down arrow shows an empty list. GeographicMap is not associated with diagrams, it's only associated with geographic features stored in the Base_Map and pipelines feature datasets.
  3. Select GeoSchematic from the View Type list, and click the Diagram list. The list content automatically changes. It now references the schematic diagrams based on the GeoSchematic diagram template.
  4. Select GeoSchematic_All from the Diagrams list. The application automatically displays the selected diagram in the Map control.
  5. Select ISP_GasPlant from the View Type list, then select ARACAUI from the Diagrams list. The content of the Map control automatically changes to show the selected diagram.

Update schematic diagrams in the running application
  1. Keep ARACAIU as the active diagram. The associated schematic diagram in the schematic dataset may have been modified since the first time it was created.
  2. Click the Update Diagram button in the Toolbar control. The changes are reflected in the active diagram.
  3. Select GeoSchematic in the View Type list, select GeoSchematic_All from the Diagrams list, and click the Update Diagram button to get the updated state of the schematic diagram.

Generate schematic diagrams in the running application
  1. Select GeographicMap in the View Type list so the geographic features display in the Map control.
  2. Click the Create GeoSchematic Diagram GP task. The Create GeoSchematic Diagram dialog box opens.
  3. Type a name for the diagram in the Diagram Name box (for example, GeoSchematic_1).
  4. Click the Add New Feature tool, click the map to digitize the feature polygon's vertices, then double-click the last vertex of the new polygon to finish the sketch.
  5. Click Submit. The GP task is executed; it uses the Intersect Relationship on the newly created polygon to determine the set of pipelines that intersects it and builds a diagram based on the resulting pipelines. The generated diagram is then converted to features.
  6. When the process ends, click GeoSchematic in the View Type, and click the Diagram drop-down arrow. The new GeoSchematic_1 item is listed.
  7. Click GeoSchematic_1 so the newly-generated feature diagram displays in the Map control.
  8. To create an OSP diagram based on another new digitized feature, repeat steps 1 through 7 using the Create OSP Diagram GP task.
  9. Click Create ISP Diagram. The Create ISP Diagram dialog box opens.
  10. Type GUAMARE, ESTANCIA, or ESCADA that correspond to gas plant names whose content is described in the geodatabase ISP_EQUIPMENTS, ISP_PIPES, and ISP_VALVES object tables.
  11. Click Submit.
  12. When the process ends, click ISP_GasPlant in the View Type, and click the Diagram drop-down arrow. The name corresponding to the newly created feature diagram is listed.
  13. Click the item so it displays in the Map control.
  14. If needed, click the Update Diagram List command to enforce the update of the items in the Diagram list.

Additional information

Web controls
The sample Web ADF includes the following Web controls:
  • The Map control with the blue border is associated with the Schematics_For_Server_Sample map service. When the application starts, it displays the features contained in the GeographicMap data frame.
  • The Toolbar control contains the following:
    • Standard tools (Zoom In, Zoom Out, and Pan),
    • A custom Full Extent command that zooms to the full extent of the schematic diagram content when a diagram is displayed in the Map control,
    • The View Type drop-down box that allows you to filter the type of data you want to display (GeographicMap, ISP_GasPlant, OSP, or GeoSchematic),
    • The Diagram drop-down box to select the diagram you want to display when ISP_GasPlant, OSP, or GeoSchematic is selected in the View Type box.
  • The TOC control that displays at the right of the Map control shows what is displayed in the map. It can be a schematic diagram with its schematic feature layers or the GeographicMap features layers.
  • The Schematic GP task window references three GP tasks related to the GP models stored in the Schematics_For_Server.tbx that allow schematic diagram generation. The Update Diagram GP model is not available through a GP task like the others; however, it can be launched by clicking the Update Diagram button in the Toolbar control.
When the Web ADF starts, since GeographicMap is the type of view referenced by default in the View Type drop-down box, the Map control displays the geographic features stored in the pipelines and Base_Map feature datasets.
 
Sample geodatabase data requirements
The Web application is based on the SchematicsForServer geodatabase sample that contains the following components:
  • The following feature classes, object tables, and relationship classes from which schematic diagrams are generated:
    • Base_Map and pipelines feature datasets that contain geographic features describing gas and oil pipeline geometric networks in Brazil,
    • ISP_EQUIPMENTS, ISP_VALVES, and ISP_PIPES non-spatial object tables that describe the connectivity inside some of the gas plants that compose the gas pipelines network,
    • Electric_Feeds_GasPlant relationship class relates each gas plant to the electric feeder that feeds it.
 
  • A Schematic dataset containing the following schematic diagram template definitions:
    • The GeoSchematic diagram template is configured to generate diagrams from features contained in the pipelines and Base_Map feature datasets.
    • The OSP diagram template is also configured to generate diagrams from features contained in the pipelines and Base_Map feature datasets. In this type of diagram, however, the generation is completed by the execution of two predefined rules: a first rule allows gas plants and electric feeders contained in the diagrams to be related to each other based on the Electric_Feeds_GasPlant relationship class, and a second rule automatically reduces useless network net junctions.
    • The ISP_GasPlant diagram template is set to create diagrams that show the connectivity inside gas plants. It operates by querying the non-spatial data stored in the ISP_EQUIPMENTS, ISP_VALVES, and ISP_PIPES tables.
Note: ArcGIS Desktop with the Schematics extension must be used to configure schematic datasets and specify the schematic diagram templates managed by the application. For more information about the Schematics extension, see An overview of Schematics
 
Data is included with the sample in the data subdirectory.
 
The map document to publish
The map document that contains the diagrams to publish to ArcGIS Server must be organized with different data frames, one for the geographic features and one per schematic diagram template. That is, each data frame related to a diagram template contains one schematic diagram of this diagram template. In this sample Web application, the diagram template and data frame names are the same, this makes easier to know which data frame is related to a particular diagram template.
 
The geoprocessing toolbox to publish
The custom toolbox provided with this sample contains the following GP models to generate and update diagrams:
  • The Create OSP Diagram and Create GeoSchematic Diagram GP models enable you to create diagrams implemented by the OSP and GeoSchematic diagram templates. These models chain the same standard GP tools: Select Layer By Location (to specify the set of features on which the diagram generation will be based) and the Create Diagram (to start the diagram generation in the schematic dataset).
  • The Create ISP Diagram GP model enables you to create diagrams implemented by the ISP_GasPlant diagram template. It uses the Create Diagram GP tool.
  • The Update Diagram GP model updates any diagram of the schematic dataset. It uses the Update Diagram GP tool.


ArcGIS_Schematics_ServingDiagrams_CSharp\Default.aspx Contains the Web user interface to interact with server-side code.
ArcGIS_Schematics_ServingDiagrams_CSharp\Default.aspx.cs Code behind the .aspx file. References Web ADF libraries and functionality.
ArcGIS_Schematics_ServingDiagrams_CSharp\App_Code\SchematicCommands.cs Custom Schematics commands for the Web application.
Download the C# files
ArcGIS_Schematics_ServingDiagrams_VBNet\Default.aspx Contains the Web user interface to interact with server-side code.
ArcGIS_Schematics_ServingDiagrams_VBNet\Default.aspx.vb Code behind the .aspx file. References Web ADF libraries and functionality.
ArcGIS_Schematics_ServingDiagrams_VBNet\App_Code\SchematicCommands.vb Custom Schematics commands for the Web application.
Download the VB.NET files

Download the files for all languages