Exercise 6: Quick-start guide for configuring the Standard builder to operate from custom queries

Complejidad: Principiante Requisitos de datos: Configuración de datos de tutorial de ArcGIS Ruta de datos: C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\Mixed_Data Objetivo: Configuring a schematic diagram template based on the Standard builder to generate diagrams from custom queries, configuring its associated schematic feature classes

Schematic diagrams can be generated from pretty much any data that can be connected to via an ADO or ODBC connection (the data does not need to be inside a geodatabase). The Standard builder is generally used to generate diagrams from GIS features highlighted in a map after a selection or trace operation, but it can also be configured to generate diagrams from either data that is not in a geodatabase or is just pure tabular, nonspatial data. Since this configuration requires you to write SQL queries directly to a data source, you must have experience writing SQL queries and have a thorough understanding of your data and its structure. During this exercise, you are going to learn how to create and configure a schematic diagram template to generate diagrams from tabular, nonspatial data. The data that you will be working with is in the Brazil.gdb tutorial database, which is located in C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\Mixed_Data. The configuration of the diagram template is going to be done using the SchematicBuilderSamples schematic dataset created during exercise 1.

NotaNota:

The screen shots in this exercise show configuration parameters created during the previous exercises. Those exercises are not a prerequisite for this exercise. You can follow the steps explained in this exercise without having completed the previous exercises.

Exploring the source data that you will be using

The first phase of this configuration is all about understanding the data and connecting to the data so you can then configure queries to use the data.

Pasos:
  1. Start the ArcCatalog application.
  2. Navigate to C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\Mixed_Data.
  3. Double-click the Brazil.gdb entry to open its contents.

    In the Contents tab of the Catalog window, you now see three tables prefixed with ISP_. This stands for Inside Plant. The records in these tables describe the internal workings of some gas plants. The gas plants themselves are real features that are part of a geometric network and can be found in the pug_PUG_gas_plants feature class, which is inside the pipelines feature dataset.

    Explore brazil File GDB

  4. Double-click the pipelines feature dataset to expose the geometric network feature classes.
    Explore pipelines feature dataset
  5. Select the pug_PUG_gas_plants feature class and click the Preview tab.
  6. At the bottom of the Preview tab, use the Preview drop-down list to choose Table so you can see the data.
  7. Use the scrollbar to scroll over so you can see both the NAME and the PLANT_NMBER fields.

    NotaNota:

    You may need to resize the columns so you can see them at the same time.

    You only have both PLANT_NUMBER and NAME data for three of the gas plants. The idea here is that you will want to allow an end user in ArcMap to choose to generate a diagram for one of these plants based on its Name (the end user doesn't need to know the plant_number). However, you will see in a minute that to query the records from the ISP_ tables, you have to have the PLANT_NUMBER. So these are both important details from this feature class.

    Explore pug_PUG_gas_plants feature class

  8. Select the ISP_EQUIPMENTS table from the Catalog tree.

    This displays as a table on the Preview tab.

  9. Scroll over in the Preview tab until you can see both the NUMBER_ and the PLANT_NUMBER columns.

    The NUMBER_ column gives you a unique number for each of the records. The PLANT_NUMBER column tells you which gas plant each record lies within. The basic idea that you will follow during configuration is that if a user wants to see the diagram for plant Aracaui (plant_number = 101), then you need to run a query to get all the ISP_EQUIPMENTS records for PLANT_NUMBER 101.

    Explore ISP_EQUIPMENTS object table

  10. Take a quick look at ISP_VALVES by selecting it in the Catalog tree.

    This table has basically the same structure, where you find a NUMBER_ and a PLANT_NUMBER column.

  11. Now click the ISP_PIPES table in the Catalog tree.

    This table is the key to this particular custom query application. This table gives you the connectivity between ISP_EQUIPMENTS records and ISP_VALVES records.

  12. Scroll over in the Preview tab until you can see the FROM_NODE_NUM and TO_NODE_NUM columns.

    For each row in this table (an individual pipe inside the plant), these columns tell you what they connect to and from based on the values in those columns matching a value from the Number_ column in either the ISP_EQUIPMENTS or ISP_VALVES table.

    Explore ISP_PIPES object table

Connecting to an external database

Pasos:
  1. Edit the SchematicBuilderSamples schematic dataset stored in the C:\ArcGIS\ArcTutor\Schematics\TutorialSchematicDB geodatabase by browsing to this database using ArcCatalog, right-clicking the dataset, and choosing the Edit menu option Edit schematic dataset button.
    NotaNota:

    The screen shots in this exercise show configuration parameters created during the previous exercises. Those exercises are not a prerequisite for this exercise. You can follow the steps explained in this exercise without having completed the previous exercises.

  2. Before going further, you need to create a new Data Source that points to the data reviewed in the Brazil.gdb database. The rest of the configuration will need to make use of this data source:
    1. Right-click the Data Sources folder in the Schematic Dataset Editor tree and click New Data Source.

      A Properties tab now shows information for the new data source. Keep the default name, and since Brazil.gdb is a file geodatabase, the Type is also correct.

      New Data Source properties page initial state

    2. Click the Browse for ESRI File Geodatabase button at the end of the GDB File text box.

      This opens the ESRI File GDB Connection dialog box.

    3. Browse to and select the brazil.gdb database located in C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\Mixed_Data.
    4. Click the Select button to close the dialog box.
    5. Click OK on the Properties tab.

    You have now successfully made a connection to the other database.

    New Data Source properties page final state

Creating a schematic diagram template based on the Standard builder

The second phase consists of creating the schematic diagram template that will be used to generate diagrams from the tabular data.

Pasos:
  1. Right-click the SchematicBuilderSamples entry in the Dataset Editor tree and click the New Schematic Diagram Template menu item.

    A Properties tab for the new schematic diagram template automatically displays on the right side of the Editor Window.

    New Diagram Template CQBBuilder initial properties page

  2. Type DiagramsFromCustomQueries in the Name box.
  3. Choose Standard Builder in the Schematic Builder section.
  4. Click OK.

    An entry for the DiagramsFromCustomQueries diagram template now displays in the Dataset Editor tree. Three new tabs (Associations, Layouts, and Rules) display on the right side of the Editor Window.

    DiagramsFromCustomQueries created

  5. Click the DiagramsFromCustomQueries entry in the Schematic Dataset Editor tree to start working on its configuration.
  6. Click the Query/Identifier Editor button Query/Identifier Editor button located in the Query area on the Properties tab.

    This opens the Query/Identifier Editor dialog box:

    Query/Identifier Editor from diagram template - initial state
    NotaNota:

    On your own projects, if you are working with data that does not need to be filtered, you would not need to do any more configuration for the diagram template and would just start working on the schematic feature classes. Since you want to filter, you need to set the filter up at the diagram template level.

  7. Use the Data Source drop-down list to select the NewDataSource entry that was created in the Connecting to an external database section above.

    The tables list now fills in with all the tables found in that data source. You want to get a list of the gas plant names and their numbers now.

  8. Scroll over in the tables list until you find the entry for pug_PUG_gas_plants. Double-click this entry.

    The system has added a query to the query section. It is returning all columns from that table. You want the end user in ArcMap to be given a list of just the names. So for the identifier section, that is what you will specify.

  9. In the Fields list at the bottom of the form, double-click the NAME entry, which will add it to the Identifier list.

    Query/Identifier Editor from diagram template final state

  10. Click OK to close the form.
  11. Add an attribute to get the plant number. (This will be used to filter the data when you write the queries for your schematic feature classes.) Right-click the DiagramsFromCustomQueries entry in the Dataset Editor tree and choose New Attribute from the pop-up menu.

    This opens the New Attribute properties tab on the right side of the editor. There are many types of attributes available in Schematics. In this case, you are just getting a field from the query you already wrote. Field happens to be the default Type.

    New Attribute on diagram template - initial state

  12. Type PlantNum in the Name field.
  13. Scroll over in the Fields list until you see PLANT_NUMBER. Double-click this entry to add it to the Identifier list.
  14. Click OK to finish this attribute definition.

    New Attribute on diagram template - created

  15. Click Save icon Save on the Schematic Dataset Editor toolbar.

Creating the Schematic Feature Classes

Pasos:
  1. Right-click the DiagramsFromCustomQueries diagram template entry in the Dataset Editor tree and click the New Schematic Feature Class menu item.

    A Properties tab for the new schematic feature class automatically displays on the right side of the Editor Window.

    New Schematic Feature Class properties page - initial

  2. Type ISP_Equipments in the Name field.
  3. Click OK.

    ISP_Equipments creation step1

  4. Right-click the DiagramsFromCustomQueries diagram template entry in the Dataset Editor tree and click the New Schematic Feature Class menu item.

    A Properties tab for the new schematic feature class automatically displays on the right side of the Editor Window.

  5. Type ISP_Valves in the Name field.
  6. Click OK.

    ISP_Valves creation step1

  7. Right-click the DiagramsFromCustomQueries diagram template entry in the Dataset Editor tree and click the New Schematic Feature Class menu item.

    A Properties tab for the new schematic feature class automatically displays on the right side of the Editor Window.

  8. Type ISP_Pipes in the Name field.
  9. Use the Type drop-down list and select Link.

    The pipe records are the links between the valves and equipment.

  10. Click OK.

    ISP_Pipes creation step1

  11. Click Save icon Save on the Schematic Dataset Editor toolbar.

Configuring the ISP_Equipments Schematic Feature Classes

Pasos:
  1. Use the mouse to click the ISP_Equipments entry in the Schematic Dataset Editor tree.

    This opens the Properties tab for this schematic feature class.

  2. Choose Query On Generate/Update from the Evaluation Mode drop-down list on the Query section.

    The Query/Identifier Editor button Query/Identifier Editor button becomes available:

    ISP_Equipments schematic feature class - Query evaluation mode changed

  3. Click the Query/Identifier Editor button Query/Identifier Editor button.

    This opens the Query/Identifier Editor dialog box.

  4. Use the Data Source drop-down list to pick the NewDataSource entry from the list.

  5. Double-click the ISP_EQUIPMENTS entry in the Tables list.

    This automatically adds a query to the Query section.

  6. This time, however, you need to change the query so it properly filters out the records based on the gas plant's number that the user will pick when generating diagrams. Modify the query by adding the following text to the end of what was automatically done for you: where plant_number = ?

    Once you have typed this in, a new Parameters section automatically opens. This allows you to tell the system which attribute will be passed into the query in place of the ?. Since your configuration only had one attribute, it is already selected.

    ISP_Equipments query definition

  7. You do need to change one thing, though. By default, the Is Text check box is checked. In your case though, this data is a number, so you need to change this check box. Click the check box for Is Text so that it becomes unchecked.
  8. You can test your query at this point if you want to. Type in a valid PlantNum in the Test Value field (101, for example, is the Aracaiu gas plant), then click the Show Results button.

    If the query evaluated correctly, you should see only records that have that value.

  9. Double-click the NUMBER_ entry in the Fields list to add it to the Identifier list.

    Every schematic feature on a diagram must be uniquely identified. In this example, you know that the NUMBER_ field is unique across all tables used to retrieve data. In your own examples, you will need to make sure you have unique values, and in some cases, you may need to do some creative things to ensure they are unique.

    ISP_Equipments query definition final

  10. Click OK to finish this definition.

Configuring the ISP_Valves Schematic Feature Classes

Pasos:
  1. Use the mouse to click the ISP_Valves entry in the Dataset Editor tree.

    This opens the Properties tab for this schematic feature class.

  2. Choose Query On Generate/Update from the Evaluation Mode drop-down list on the Query section.
  3. Click the Query/Identifier Editor button Query/Identifier Editor button on the Properties tab.

    This opens the Query/Identifier Editor dialog box.

  4. Use the Data Source drop-down list to pick the NewDataSource entry from the list.
  5. Double-click the ISP_VALVES entry in the Tables list.

    This automatically adds a query to the Query section.

  6. You need to change the query so it properly filters out the records based on the gas plant's number that the user will pick when generating diagrams. Modify the query by adding the following text to the end of what was automatically done for you: where plant_number = ?

    Once you have typed this in, a new Parameters section will automatically open. This allows you to tell the system which attribute will be passed into the query in place of the ?. Since your configuration only had one attribute, it is already selected.

  7. You do need to change one thing, though. By default, the Is Text check box is checked. In your case though, this data is a number, so you need to change this check box. Click the check box for Is Text so that it becomes unchecked.
  8. You can test your query at this point if you want to. Type in a valid PlantNum in the Test Value field (101, for example, is the Aracaiu gas plant), then click the Show Results button.

    If the query evaluated correctly, you should see only records that have that value.

  9. Double-click the NUMBER_ entry in the Fields list to add it to the Identifier list.

    Every schematic feature on a diagram must be uniquely identified. In this example, you know that the NUMBER_ field is unique across all tables used to retrieve data. In your own examples, you will need to make sure you have unique values, and in some cases, may need to do some creative things to ensure they are unique.

    ISP_Valves query definition final

  10. Click OK to finish this definition.

    The Query/Identifier dialog box closes, and the Properties tab for the ISP_Valves schematic feature class displays as follows:

    ISP_Valves properties tab - final state

Configuring the ISP_Pipes Schematic Feature Classes

For the last feature class configuration section, you do almost exactly the same except for the names of the feature classes and the names of the tables being queried. This time, the configuration for the queries will still be the same, but you will have to do some further work to define some attributes to tell the system which fields are used for connectivity between nodes.

Pasos:
  1. Use the mouse to click the ISP_Pipes entry in the Dataset Editor tree.

    This will open the Properties tab for this schematic feature class.

  2. Choose Query On Generate/Update from the Evaluation Mode drop-down list on the Query section.
  3. Click the Query/Identifier Editor button Query/Identifier Editor button on the Properties tab.

    This will open the Query/Identifier Editor dialog box.

  4. Use the Data Source drop-down list to pick the NewDataSource entry from the list.
  5. Double-click the ISP_PIPES entry in the Tables list.

    This automatically adds a query to the Query section.

  6. You need to change the query so it properly filters out the records based on the gas plant's number that the user will pick when generating diagrams. Modify the query by adding the following text to the end of what was automatically done for you: where plant_number = ?

    Once you have typed this in, a new Parameters section will automatically open. This allows you to tell the system which attribute will be passed into the query in place of the ?. Since your configuration only had one attribute, it is already selected.

  7. You do need to change one thing, though. By default, the Is Text check box is checked. In your case though, this data is a number, so you need to change this check box. Click the check box for Is Text so that it becomes unchecked.
  8. You can test your query at this point if you want to. Type in a valid PlantNum in the Test Value field (101, for example, is the Aracaiu gas plant), then click the Show Results button.

    If the query evaluated correctly, you should see only records that have that value.

  9. Double-click the OBJECTID entry in the Fields list to add it to the Identifier list.

    Every schematic feature on a diagram must be uniquely identified. In this example, you know that the OBJECTID field is unique across all tables used to retrieve data. In your own examples, you will need to make sure you have unique values, and in some cases, may need to do some creative things to ensure they are unique.

    ISP_Pipes query definition final

  10. Click OK to finish this part of the ISP_Pipes definition.

    The Query/Identifier dialog box closes, and the Properties tab for the ISP_Pipes schematic feature class displays as follows:

    ISP_Pipes properties tab - final state

  11. Right-click the ISP_Pipes entry in the Schematic Dataset Editor tree and choose New Attribute.

    This opens a Properties tab for the new attribute.

    FromNode attribute definition - start

  12. Use the Name drop-down list to pick OriginNode from the list of predefined attributes.

    This list of attributes is predefined by the system. They all impact certain functionality in the system. OriginNode is an attribute that will tell a link which node to connect to as a starting (origin) point.

  13. Double-click the FROM_NODE_NUM entry in the Fields list to add it to the Identifier list—that is, the field in the ISP_PIPES table that holds the starting point connectivity information for each pipe.
  14. Click OK to finish this attribute configuration.

    FromNode attribute definition - final

  15. Right-click the ISP_Pipes entry in the Dataset Editor tree and choose New Attribute.

    This opens a Properties tab for the new attribute.

  16. Use the Name drop-down list to pick ExtremityNode from the list of predefined attributes.

    ExtremityNode is an attribute that will tell a link which node to connect to as an ending (extremity) point.

  17. Double-click the TO_NODE_NUM entry in the Fields list to add it to the Identifier list—that is, the field in the ISP_PIPES table that holds the ending point connectivity information for each pipe.
  18. Click OK to finish this attribute configuration.

    ToNode attribute definition - final

  19. Click the Save icon Save button on the editor toolbar.
  20. Close the Schematic Dataset Editor.

Generating a custom query schematic diagram

In this section, you are going to generate your first schematic diagram based on the newly created DiagramsFromCustomQueries diagram template.

Pasos:
  1. Start ArcMap with a blank map document.
  2. Click the Generate New Schematic Diagram button Generate New Schematic Diagram icon on the Schematic toolbar.

    The New Schematic Diagram dialog box opens.

    New Schematic Diagram - Aracaui initial

  3. Click the browse button on the right of the Schematic Dataset or Folder field to open the Select schematic dataset or schematic folder dialog box.
  4. Browse to and select the TutorialSchematicDB geodatabase that was created in C:\ArcGIS\ArcTutor\Schematics during exercise 1.
  5. Double-click this geodatabase and select the SchematicBuilderSamples schematic dataset.

    New Schematic Diagram - Aracaui select schematic dataset

  6. Click the Add button.
  7. Make sure the DiagramsFromCustomQueries diagram template is the one selected in the Schematic Diagram Template drop-down list.

    ARACAIU is already selected in the Schematic Diagram Name section because it is first in the alphabetical list.

  8. Click the Schematic Diagram Name drop-down arrow to see that there is a list of all the gas plant names that came from the pug_PUG_gas_plants table.

    Remember that you wanted the user to see the friendly name and not the number. That is where the PlantNum attribute came into the configuration.

  9. Make sure that ARACAIU is still selected.

    New Schematic Diagram - Aracaui selected

  10. Click OK to generate the diagram.
    New Schematic Diagram - ARACAIU generated

    Since there were no coordinates on these tabular records, Schematics has automatically placed all the nodes at the 0,0 coordinate. If you had x and y information in the data, then you could create predefined attributes for each of the Node schematic feature classes so that the initial position of the diagram would be using the x and y from the data instead of being placed at 0,0. In either case, the user can now start an editing session and apply algorithms, and so on, to the diagram.

New Schematic Diagram - Aracaui generated


7/11/2012