Applying the ArcGIS Hydro Data Model, Part 2
CE 394K GIS in Water Resources
University of Texas at Austin
Prepared by: Reem Zoun, Kristina Schneider, Tim Whiteaker, and David Maidment
III. Connectivity Tools
This portion of the Arc Hydro exercise assumes that you’ve already prepared the data for schema application and you have available a set of prepared files in an ArcHydro geodatabase. This file is attach here as a point of departure for this portion of the exercise. Application of the ArcHydro tools requires a completely connected geometric network, which the attached file ArcHydroPart2.zip contains. These are also stored in the LRC on /class/maidment/giswr2001/archydro
These files are:
Hydrovector: a folder that contains the HydroVectorTools.dll (may be hidden from view) and the HydroVectorTools.doc that explains what the tools are and how to use them.
ArcHydro.mdb -- the geodatabase you’ll use in this exercise (pictured below)
ArcHydroLite.mdb – the schema that will be applied this geodatabase
ArcHydroAfterSchema.mdb – the result of applying the schema (as a backup in case you have trouble with doing this)
ArcHydroAfterTools.mdb – the result of applying the ArcHydro tools (as a backup in case you have trouble with doing this)
This portion of the exercise also requires that you have available and have installed the HydroVector tools. These tools can be obtained from the attached zip file or from Tim Whiteaker’s web page at http://www.ce.utexas.edu/stu/whiteatl/hydrotools.html The proper functioning of these tools requires an Application Framework to be first installed on the computer where ArcMap runs. This should already be working in the computers in ECJ 3.400 but if you need to install it, you can get the files from http://www.ce.utexas.edu/stu/whiteatl/ApFrameworkSetup.zip and its just a simple matter of unzipping this framework zip file and running the Setup application that it contains to install the framework.
Ok, lets get started!!!
What you are beginning with is a draft ArcHydro.mdb database that looks like this:
If the schema creation wizard has already been added to ArcCatalog, skip to step 3.B, Connect to the Repository.
(1) Right click in the gray area in ArcCatalog where the buttons are and click Customize. You can also click Customize under the Tools menu.
(2) Click the Commands tab.
(3) If “Case Tools” appears in the categories list, skip to step (4) of this section. If “Case Tools” is not in the categories list, click “Add from file” and browse to the Bin directory where ArcGIS was installed (/arcexe81/bin). Select SchemaWiz.dll and click Open, then click OK. If you don’t see the SchemaWiz.dll in /arcexe/bin, it may still be there but invisible. Use Tools/Find File in Windows Explorer to locate the file, and then register the .dll using RegCat.exe, which is also located in /arcexe81/bin (This may also be invisible). Use Tools/Find File to locate RegCat.exe, right click on it and create a shortcut on your desktop. Drag the SchemaWiz.dll file onto the RegCat.exe shortcut and you’ll be prompted with a dialog to define where to register the .dll. Select ArcMap, ArcCatalog and ArcTools. Now, when you go to the Categories list you will see that the Case Tools option is available and the Schema Wizard icon is visible.
(4) Click “Case Tools” in the categories list.
(1) Drag the Schema Wizard command onto a toolbar.
(2) Click Close.
(1) In the ArcCatalog tree, click the ArcHydro geodatabase to which you will apply the schema, so that it opens and you can see the feature dataset it contains.
(2) Click the Case Schema Creation button to launch the Schema Creation Wizard. You may get a message saying that this action requires an ArcGIS or ArcEditor version of ArcGIS. In that event, go to Programs/ArcGIS/Desktop Administrator and set the seat to ArcGIS or ArcEditor.
(3) Click Next to skip the introduction step, and then click Browse to select the repository database (in this exercise, ArcHydroLite.MDB). Ignore User Name and Password Requirement if asked for. Click Next to continue.
(4) Click the name of the object model in the repository for which you want to generate schema (ArcHydroLite :: ArcHydroLite).
(5) Click Next. This process may take a few minutes. A screen might appear asking you if you would like to use default values or values from a previous run. Select to use the default values. Press Next.
A tree-view of the schema represented in the model is displayed. Using this tree-view, you will now select the object classes (tables), feature datasets, and feature classes from your UML model for which you want to generate schema. The feature classes, highlighted with red, have been detected by the schema creation wizard since they have the correct Arc Hydro Lite name.
Note that the Object class TimeSeries is not highlighted with red, meaning that a corresponding object class has not been selected or it has not been created. If you generate a schema for datasets that do not already exist in ArcHydro.mdb, new datasets will be created but they will not have any data loaded into them. You can come back at a later time when you do have such data and reapply the schema to include the new data in your Arc Hydro model. You can specify the spatial reference for a new feature dataset by selecting the dataset and clicking Properties. If you generate schema for feature classes that do not already exist, empty classes (tables with no rows) will be created.
(1) Click on the Arc Hydro feature dataset and then click Properties.
(2) On the Feature Dataset Properties window click Show Details to show the spatial reference information. Note that the spatial reference for that feature dataset has already been set (and that it coincides with the reference for the existing feature dataset).
(3) Click OK to close the properties window.
(4) Double Double-Click on “Watershed” and a dialog box for Watershed Properties will appear.
(5) Click on the Exists tab. Note near the top of the window that there is a check mark by “Feature class already exists in database” and the Watershed is listed in the Feature Class box. In this window you will match fields that were defined in the UML model to those that already exist in the Watershed feature class.
(6) In the “In existing object” column, click on “click to select” in the HydroID row. HydroID does not currently exist in the Watershed feature class; so select <Add Field> to add the field from the dropdown menu bar that is presented.
(7) Repeat step (6) for all unmatched UML class. Note: For this exercise just select <Add Field> for all UML class In Watershed Properties dialog box.
Your Dialog box should look like this after you have matched all fields:
(8) Click OK and you will go back to Schema Wizard.
(9) Repeat steps 4, 5, 6, 7 & 8 for all feature classes in ArcHydro. You should have <Add Field> for any unmatched fields in all existing classes. Don’t worry about the ArcHydro_Junctions class since it is empty and we don’t need it.
(10) Click OK and you should be back to Schema Wizard.
Once you have connected to the repository and selected the classes from your UML model for which you want to generate schema, the last part of the Schema Wizard is to actually create the schema in the geodatabase.
(1) Click Next.
At this point, you could review the options you specified in the Schema Wizard. If you wanted to change anything, you would click Back and change the appropriate parameters.
(2) Click Finish to generate the schema in the geodatabase. The generation may take a while. Say No to if you wanted to see the logfile (or Yes if you wanted to see the logfile!).
Congratulations! You have generated a schema!
If you View the feature classes that you’ve just worked on in ArcMap, open the attribute tables, you’ll see that what you have done is to create a series of additional attributes at the right hand end of your attribute tables --- these are the standard Arc Hydro attributes.
To be turned in: Make a table that lists the five feature classes: HydroEdge, HydroJunction, HydroPoint, Waterbody and Watershed and list the attributes that were added to these feature classes by the process of applying the ArcHydro schema.
1. Right click in the gray area in ArcMap where the buttons are and click Customize. You can also click Customize under the Tools menu. Click the Toolbars tab.
2. If ‘HydroVector Tools’ appears in the toolbars list, skip to step 3 of this section. If ‘HydroVector Tools’ is not in the categories list, click “Add from file” and browse to the arcgis/arcexe81/Bin directory or wherever the HydroVectorTools.dll is stored. Select HydroVector.dll and click Open, then click OK. The ArcHydro Tools will appear on your Toolbars list now. If you don’t see the toolbar appear, copy the HydroVectorTools.dll to arcgis/arcexe81/Bin, and then right click on the .dll file and Register it. Then, repeat the tool addition procedure. You should now be able to see the tool set.
3. Click on the boxes for Editor, Utility Network Analyst and HydroVector Tools. You will need all three of these tools to apply the HydroVector Tools.
4. All three of the toolbars will appear on the screen. You can drag it onto the top of the screen or leave it floating. The HydroVector Tools toolbar looks like this:
5. Click Close to close the customize window.
The HydroVector tools can determine values for ArcHydro attributes in a HydroNetwork.
1. Add HydroNetwork data layer to ArcMap.
If you open the attribute Tables of the HydroJunction and HydroEdge, you will find that the last few columns of the tables are blank. We will use HydroVector Tools to calculate the values for some of these columns.
2. Go to View/Toolbar and click the Editor Toolbar on if it is not already active. On the Editor Toolbar click on Editor/Start editing.
This tool assigns the HydroID values to the junctions and edges.
3. Right click on HydroJunction and Open Attribute Table for HydroJunction. You will find HydroID* column with <null> values in it.
4. Click on Assign HydroID . The values of HydroID appear on the HydroID column of the attribute table of HydroJunction.
5. Open the attribute table of HydroEdge. You will find that the values of HydroID in the HydroID column instead on <null> value. Assign HydroID tool has applied the values of HydroID to all five feature classes in the Arc Hydro Lite geodatabase. Each class is identified with a different leading integer (1-5) and then each object within the class by an objectID at the end of the HydroID value. For example, 1000004 is object 4 in feature class 1, while 3000001 is object 1 in feature class 3.
Your Attribute Tables should look like this (don’t worry if your feature class integer values do not exactly correspond to those shown below).
6. Close the attribute tables.
The Length Downstream Tool can calculate the downstream length from any junction or edge.
7. Save the ArcMap file and call it ‘Network_Tools’.
8. You will have to set the flow directions of your network before you can apply the Network Attributes Tool. Click on Editor/ Start editing. Select the most downstream junction on your network as shown in the picture below:
9. Click on Attributes button on the Editor toolbar. The Attributes dialog box for the selected HydroJunction will appear. Set the ancillary role of the selected junction to sink.
10. Close the attributes dialog box.
11. Click on the Set Flow Direction button.
12. Go to Flow/Display Arrows For and click on the HydroEdge box. Click on Flow/Display Arrows.
Your Network should look like the following diagram. If the network edges upstream of Canyon Lake are not shown with directions, it means that you need to build the Rf1guad shape file as a coverage and import that into the Arc Hydro geodatabase, rather than working with the Rf1guad shapefile imported into the geodatabase.
13. You can remove the display of arrows by clicking on Flow/ Display Arrows again or leave the arrows on as you wish.
14. Now we are going to determine the values of the LengthKm attribute. Open the attribute table for HydroEdge, right click on the LengthKm field, and open the Field Calculator. Set the result equal to Shape_Length/1000 (Shape_Length is in meters)
15. Right click on HydroEdge and Open Attribute Table for HydroEdge. You will find LengthDown column with <null> values in it.
16. Go to Network Attributes/ Length Downstream/ Calculate Length Downstream for Edges. Select HydroEdge for calculating Downstream Length and LengthKm for Length Field. Click OK.
The values of downstream length from each edge will appear on the LengthDown column of the Attribute table. The table should look like this:
17. Close the Attribute Table of HydroEdge.
18. You will now use the Calculate Length Downstream for Junctions to calculate length downstream from a particular junction. Right click on HydroJunction and Open Attribute Table for HydroJunction. You will find LengthDown column with <null> values in it.
19. Go to Network Attributes/ Length Downstream/ Calculate Length Downstream for Junctions. Select HydroJunction for calculating Downstream Length and LengthKm for Length Field. Click OK.
The values of downstream length from the selected junction will appear on the LengthDown column of the Attribute table. Close the attribute table for HydroJunction.
Now, lets figure out what you have been doing. Open the attribute table for HydroJunction, and under Properties, edit the Label properties to set the Label attribute to LengthDownstream. Similarly, set the Label attribute of HydroEdge to LengthKm. Right click on the HydroJunction and HydroEdge classes, and Label features. If you zoom in near the downstream outlet of the Guadalupe watershed, you should see something like the following diagram. The length downstream of the most downstream junction is 0 (this is where water flows into the Gulf of Mexico). The first river reach upstream of the outlet has length 17.72 km, so the LengthDownstream of the upstream junction is 17.72km, and so on for the succeeding upstream reaches and junctions. Pretty cool!!
The Flow Direction tool can be used to store or assign flow directions of edges. The tools works on a selected set of edges or the entire set if no edges are selected.
To be turned in: What is the maximum flow distance from any point in the Guadalupe network to the outlet? What is the flow distance from Canyon Lake to the outlet? How far downstream from Canyon Lake is the Cuero stream gage?
The Store Flow Direction Tool reads flow direction for edges from the network and writes those values to the edge attribute table.
20. Right click on HydroEdge and Open Attribute Table for HydroEdge. Move to the FlowDir column in the Attribute Table. It will have <null> values in it. We will use the Store Flow Direction tool to populate this column.
21. Go to Network Attributes/ Flow Direction/ Store Flow Direction. Click.
22. Select HydroEdge as Edge Layer to store flow direction in the dialog box. Click OK.
The values of Flow Direction will appear on the FlowDir column of the Attribute table. In this case it is 2, which represents flow against digitization. The table should look like this:
The Assign Flow Direction tool assigns flow direction to edges. You may assign flow direction based on the selected esriFlowDirection constant, or you may assign flow direction based on values in a field in the edge layer. The values in the field must correspond to esriFlowDirection constants. The tool works on a selected set of edges or the entire set if no edges are selected. (By Tim Whiteaker - 10/10/2001)
Find Next Downstream Junction tool uses the network to find the next downstream junction in a particular feature class (HydroEdge or HydroJunction), and assigns the HydroID of the downstream junction to the NextDownID field in the upstream junction.
23. Right click on HydroJunction and Open Attribute Table for HydroJunction. You will find NextDownID column with <null> values in it. We will use the Find Next Downstream Junction tool to populate this column.
24. Go to Connectivity/ Find Next Downstream Junction. Click.
25. Select HydroJunction as Junction Layer in the dialog box. You can click on the help button to find out more about the tool. Click OK.
The values of HydroID for the next downstream junction for each junction will appear on the NextDownID column of the Attribute table. You will find value of –1 for the most downstream junction in the network. If the tool does not find a downstream junction for a particular feature, it assigns a value of –1 to the feature’s NextDownID.
If you set the labels for HydroJunction to NextDownID and zoom to the basin outlet, you’ll find a display similar to the following:
The most downstream HydroJunction has HydroID 4000001, which is the NextDownID of the next upstream junction (4000002). You can see that junction 4000003 is the NextDownID for two upstream junctions because it lies at a confluence in the river system.
The Store Area Outlets tool locates outlet junctions for a set of areas. It writes the HydroID of the outlet to the JunctionID field in the area feature class. If a JunctionID field does not exist in the area feature class, one will be created for you. The junction feature class must have a HydroID field of type Integer.
Note that the Junction Intersect method does NOT create junctions at the intersection of the areas and the network for you. The tool assumes that this step has already been done using the Geoprocessing Wizard, as described earlier.
If an outlet could not be found for a given area after the execution of all specified methods, then no JunctionID is assigned for that area.
26. Add the Watershed data layer from your ArcHydro dataset. Apply color scheme to the data layer using unique values for categories from Layer Properties/ Symbology.
27. Right click on Watershed and Open Attribute Table for Waterhshed. You will find JunctionID* column with <null> values in it. We will use the Store Area Outlets tool to populate this column.
28. Go to Connectivity/ Store Area Outlets. Click. In the Store Area Outlets dialog box select Junction Intersect as method and set the Search Tolerance to 1000 map units.
If you click on the info button for each method, you will have information about that particular method. You can also click on help for more information about the tool. Click OK.
29. Select Watershed as the Area Layer and HydroJunction as the Outlet Layer in the Select Input Layer dialog box. Click OK.
The tool will require a few seconds to calculate. The HydroID of the outlet junctions will be written in the JunctionID* column in the Watershed attribute table.
The table should look like this:
30. Close the attribute tables.
The Consolidate Attributes tool consolidates values from an input feature layer or table to an output feature layer or table. Consolidation operations include sum, max, min, count, average, median, mode, and standard deviation.
31. Lets populate the AreaSqKm attribute of the Watershed feature class. Right click on this attribute, and open the field calculator set the result for AreaSqKm to Shape_Area/1000, as shown:
32. Right click on HydroJunction and Open Attribute Table for HydroJunction. You will find DrainArea column with <null> values in it. We will use the Consolidate Attributes tool to populate this column.
33. Go to Consolidate Attributes. Click. The Select Layers dialog box will appear
34. In the dialog box, select ‘Watershed’ as the layer with values to be consolidated and ‘Hydrojuction’ as the layer where results will be stored. Click OK
35. For the ‘From layer’, select ‘AreaSqKm’ as Field with Values to be Consolidated and ‘JunctionID’ as Key Field that Identifies Related Features in ‘To’ Layer. For the ‘To Layer’, select ‘DrainArea’ as Field where Consolidated Values will be Stored and ‘HydroID’ as Field that Identifies Features in this Layer.
In the attributes table of HydroJunction, the drainage area of the relevant Junctions has been stored under the DrainArea column.
36. Close the attribute tables.
You have just applied all the HydroVector Tools!
To be turned in: What is the drainage area (km2) for each of the four watersheds and for the drainage basin as a whole? Which feature classes are connected by relationships in the data model? What attributes are used as the key fields in these relationships?
GO to Home Page