Exercise 4. Building a Base Map and a Point Coverage

CE 397 GIS in Water Resources
University of Texas at Austin

Goals of the Exercise

This exercise is intended for you to build a base map of geographic and flow data for a watershed using the Guadalupe Basin in South Texas as an example. This base map comprises watershed boundaries from the US Geological Survey's Hydrologic Unit Code (HUC) coverage and streams from the US Environmental Protection Agency's River Reach File 1 (RF1) coverage. In addition, you will create a point coverage of stream gage sites by inputting latitude and longitude values for the gages in a text file, creating the coverage in geographic coordinates, and then projecting it into the same projection as the HUC and RF1 files. You will then link to the US Geological Survey's website in Texas, download some streamflow data and make a plot of the flow hydrograph.

Computer and Data Requirements

This exercise uses both Arcview and Arc/Info. It should be executed on the Dec Alpha workstations.

The HUC boundaries are a subdivision of the US made by the US Geological Survey to show major and minor river basins. There are 2-, 4-, 6-, and 8-digit HUC boundaries, where the larger the number the smaller the area. The HUC8 boundaries are the basic ones. I have selected from the maps covering the whole United States, the HUC's and Rf1 reaches in the zone defined by HUC2 = 11, 12 or 13 which is the region covering Texas and neigboring States, and put them into coverages call Huctx and Rf1tx for you to work on. The RF1 coverages have the names of the rivers and streams annotated onto the stream arcs.

The HUC and RF1 coverages for the United States can be downloaded over the internet:

USGS Hydrologic unit code
EPA river reach files

Procedure for the Assignment

Get Stream and Watershed Data for Texas

To start off, you'll copy the RF1 and HUC coverages from the GIS-Hydro 97 CD-ROM. Logon to a workstation and, at the $ prompt, make a directory under your data directory called ex4:

$: mkdir ex4
$: cd ex4

Copy the files edwards.e00, huctx.e00, and rf1tx.e00 from the directory gishyd97/class/base_map/gisfiles of the GIS-Hydro 97 CD-ROM to your working space. The files are in Arc/Info export format, as indicated by the .e00 so you will need to import them using the arc IMPORT command. Fire up Arc/Info using $arc, and then import each of the coverages

Arc:import cover edwards edwards
Arc:import cover huctx huctx
Arc:import cover rf1tx rf1tx

Once these coverages are copied into your area, do a describe on each of them and take a look at their projections. This information will be valuable later because you will project gage locations into the same projected coordinates.

Arc: describe huctx
Arc: describe rf1tx
Arc: describe edwards
Arc: quit

To be turned in: A copy of the description of the huctx coverage. How many polygons are contained in this coverage? How many arcs are in the coverage? What is the name of the map projection in which the data are presented? What system was used to specify the projection parameters?

Selecting the Guadalupe Basin Watersheds

The Huctx and Rf1tx coverages cover a large region and we only want to work in the Guadalupe Basin. We'll use Arcview to identify which HUC's cover the Guadalupe Basin and to create new Arcview shapefiles of these portions of the coverages.

Start up Arcview.

$: arcview &

Once Arcview is loaded, open a new view and add the huctx theme to your view. Select (check mark) this theme in your view to get an idea of the scope of this coverage. Recolor the theme as necessary. Highlight the theme by clicking on its legend bar and use the table icon to bring up the table of its attributes. Scroll across the fields and see the huc (8 digit huc's),huc2, huc4, huc6 items. With the Table window highlighted,select the hammer icon . This gets you into the Table Query Builder. Under "Fields", scroll down to [Huc6] and double-click on it. Then click on the "=" sign. Finally, under "Values", scroll to 121002 and double-click on it. You'll notice that your sequence has been recorded (in parentheses) in Query Builder's scratch pad. Select New Set in Query Builder and you can see the Guadalupe Basin highlighted in the View. Use the promote icon in the Table window to promote the selected records to the top of the table. You will see that the Guadalupe Basin [huc6 = 121002]is comprised of four sub-basins, the Upper [huc=12100201] , Middle [huc = 12100202] and Lower Guadalupe [huc = 12100204]basins and the San Marcos basin [huc = 12100203]
Use Theme/Clear Selected Features to unselect the Guadalupe Basins in the Table Query.

In order to avoid having to work with large data sets which take a long time to draw on the screen, you are going to make a new theme containing only the huc's in the Guadalupe Basin. To do this, highlight the huctx theme in the legend bar, go to Theme/Properties, select the hammer icon, open the Query Builder, build the [huc6] = 121002 query in the same manner as you did previously, except that you select OK in both the Query Builder and Theme Property windows to complete the selection. You'll see that now only the Guadalupe River basin is displayed in the view.

Use Theme/Convert to Shapefile to produce a new theme. Name this theme hucguad.shp and save it in your local workspace for this exercise. You will be prompted to whether add this theme to the View. Do so, adding it to View1 (not New View). If you click on the theme button for hucguad, you'll see that it looks identical to the earlier huctx theme selection for the Guadalupe basin. But the new hucguad shape file is much smaller. A Shapefile is a special simplified file structure for storing geographic features in Arcview. It can be converted to an Arc/Info coverage using the Arc/Info command Shapearc if necessary.

Turn off the huctx and hucguad.shp themes in the View and Use the Add themes button to select a new theme to add to the View. Select rf1tx. Click this on and you will see a big display of the rivers of Texas and neighboring states whose drainage comes into Texas.

Getting the Guadalupe River Reaches

Note that the same actions as you've just done in Arcview can also be done in Arc/Info to build a new coverage which is a reduced copy of the original coverage. Now, we're going to do the same thing in Arc/Info except that we'll do it just for the HUC's in the Guadalupe Basin. Quit from Arcview and start up Arc:

$ arc

[create a new coverage hucguadal from huctx according the criteria specified in the following dialog]
Arc: reselect huctx hucguadal
Enter a logical expression:
: res huc6 = 121002
[hit return on this line to indicate that you have finished entering]
Do you wish to reenter this expression: (Y/N) N
[correct errors here]
Do you wish to enter another expression (Y/N) N
[add additional selections to make a more complex query if you want to include or exclude other records (use asel to add records and nsel to select the complementary set to the set previously selected)]

Now the reselection occurs and a new coverage hucguadal with just 4 HUC's is created (HUC =12100201, 12100202, 12100203, 12100204).

To get the corresponding river reaches, the Arc Intersect command is used:

Arc: intersect rf1tx hucguadal rf1guad line

This should produce a line coverage of just the 94 arcs within the Guadalupe Basin. I have been having some trouble running this function, and if it doesn't work for you, import the rf1guad.e00 from the same anonymous ftp site from which you obtained the other files for this exercise.

Quit Arc/Info, and start Arcview. Add Rf1guad as a theme to the View. Highlight the huctx and rf1tx themes in the legend bar (use Shift when highlighting the second theme) and the Edit/Delete Themes to delete them from the Project. From now on, we'll work with the Rf1guad coverage and the Hucguad Shapefiles to save time in displaying the themes.

Once you've got the Guadalupe Basin displayed, you can select the "Zoom to extent of active themes" button to bring the Guadalupe Basin up to the full extent of the screen. Now you should be able to see the Guadalupe River Basin with all of its major river reaches. If you hit the "i" button with the huctx theme highlighted and make an information query on one of the huc units, you'll see that the last field in the attribute table is a "name" field.

Highlight the rf1guad theme, click on the table icon and bring up the attribute table for this theme. Scroll across to the names of the rivers. Pname is the name of the river segment and Cname is the name of the segment to which this segment next connects downstream. Use the hammer icon in the Table window to select [pname] = "Guadalupe R", and promote the selected records to the top of the table. This shows the main channel of the Guadalupe River. The small gap in the center of the basin is the segment where the Guadalupe River flows through Canyon Lake, which is separately identified in the Pname field.

After you've established this view, make a layout of the view and print it. Save Project and exit from Arcview.

To be turned in: the layout of the Guadalupe Basin streams and watersheds..

Creating a Point Coverage of Stream Gages

Now you are going to build a new coverage yourself of stream gage locations on the Guadalupe. I have extracted information from the USGS stream gage data books information about 7 gages on the main stem of the Guadalupe River (there are many other stream gages in this basin):

Seq# Station#   Name         Longitude   Latitude   Mean Annual
                                                     Flow (cfs)
1    08176500  Victoria      97 00 46 W  28 47 34 N     2095

2    08175800  Cuero         97 19 16 W  29 03 57 N     2094 

3    08168500  New_Braunfels 98 06 35 W  29 42 53 N      552 

4    08167800  Sattler       98 10 47 W  29 51 32 N      464 

5    08167000  Comfort       98 53 33 W  29 58 10 N      215 

6    08166200  Kerrville     99 09 47 W  30 03 11 N      186

7    08165500  Hunt          99 19 17 W  30 04 11 N       81

The flow data for each of the gages was obtained from the USGS Water-Data Report TX-92-3.

(a) Define a file containing an ID and the long, lat coords of the gages

The coordinate data is in geographic degrees, minutes, & seconds. These values need to be converted to digital degrees, so go ahead and perform that computation for the 7 lon/lat pairs. This is something that you will need to do before going to the computer lab and it has to be done carefully because any errors in conversions will result in the stations lying well away from the Guadalupe River. I suggest that you prepare a table showing the gage long and lat in degrees, minutes and seconds, convert it to long, lat in decimal degrees using the formula

Decimal Degrees (DD) = Degrees + Min/60 + Seconds/3600

Remember that West Longitude is negative in decimal degrees.

Open Text Editor and create a raw data file that includes a gage sequence # (i.e. 1, 2, 3, 4,...) and the longitude & latitude coordinates converted to digital degrees. Note that longitude comes first and then latitude (because this corresponds to (x,y) coordinates in a Cartesian system).

Example: (this table should contain 7 records, the first one as shown and the other six created similarly by you from the information given above for each gage with the longitude and latitude typed into your file to replace the ... entries given in the table below).

1  -97.012778  28.792778
2     ...        ... 
3     ...        ...
4     ...        ...
5     ...        ...
6     ...        ...
7     ...        ...

DON'T FORGET TO TYPE 'end' (and press return) as the last line of your data to signal to Arc later that this is the end of the stations that you wish to enter.

Save this Text Editor file as lonlat.dat. If it saves to your root directory, you can move it to your working directory where it is needed by using from the working directory the Unix command

$ mv ~/lonlat.dat ./ [where ~ means "my root directory"]

You can also use the File Manager (file drawer icon on Dec tool bar) to move files. Open two File Managers and use drag and drop to move files from one location to another.

(b) Generate a point coverage showing the gage locations

Start up Arc, and then:

Arc: generate stations (this command invokes the "generate" function to create a coverage called "stations")
Generate: input lonlat.dat (use the Text Editor file lonlat.dat to define the data in your coverage)
Generate: points (this specifies a point coverage)
Creating points with coordinates loaded from lonlat.dat
Generate: quit
Externalling BND and TIC...
Arc: build stations points (with this command you actually create the point coverage)
Building points...
Arc: addxy stations [adds long and lat as attributes X-Coord and Y-Coord]
Arc: list stations.pat

1      0.000 0.000       1           1          -97.013   28.793
2      0.000 0.000       2           2             ...      ...
3      0.000 0.000       3           3             ...      ...
4      0.000 0.000       4           4             ...      ...
5      0.000 0.000       5           5             ...      ...
6      0.000 0.000       6           6             ...      ...
7      0.000 0.000       7           7             ...      ...

Now you have a coverage with no attribute data in it. You'll notice that the four default parameters are included for each of your records. You should have 7 records because that is the number of coordinate pairs in your lonlat.dat file.

Projecting the Point Coverage

In order to successfully overlay this point coverage on top of the RF1 and HUC coverages, it needs to be in the same projection as the others. The point coverage "stations" has still not been defined as a projection, but since the lon/lat values are in decimal degrees, that represents geographic coordinates. We are going to do this using a projection file which contains all the parameters that the project command will need.

Open a new Text Editor window from the Dec tool bar. Type the following information into the file. The first part from "input" to "parameters" tells the project command that the input coverage is in geographic coordinates. The second part from "output" to end specifies what the output coverage should look like. In this case the projection also accomplishes a datum shift from NAD27 (the datum used for USGS maps from which the latitude and longitude of gages was originally extracted) and NAD83 (the current standard earth datum).

projection geographic
datum NAD27
units dd
projection albers
datum NAD83
units meters
27 25 00
34 55 00
-100 00 00
31 10 00

Again, be sure to hit Return after you type end. Save the file and call it albprj. If necessary, move it to your working subdirectory using

$mv ~/albprj ./

You can also use the File Manager (file drawer icon on Dec tool bar) to move files. Open two File Managers and use drag and drop to move files from one location to another.

Keep this file albprj for use in later exercises as it saves having to remember all the details of what is needed to do a projection. A small library of similar projection files is contained in the directory /res2/maidment/proj/ that you may wish to use at a later time in your own project work. Making and using projection files is a very important part of building data bases because the data have to be assembled from various locations and projected into the same geographic reference coordinates.

Arc: project cover stations albstat albprj (this command will project the coverage "stations" into an albers projection called "albstat" using the projection file "albprj")

If you get a projection dialog, i.e. Projection:, it means that the albprj file could not be located or is not complete. Make sure that the albprj file is in your current working directory.

Arc: list albstat.pat

Creates a listing of selected items from the point attribute table (pat) of the new coverage.

Now do a describe to show the projection information which should be compatible with huctx, rf1tx, and edwards,so that they can be displayed together:

Arc: describe stations
Arc: describe albstat
Arc: quit

To be turned in: a description of the coverages stations and albstats which shows their projection parameters.

View and Add Attributes to the Point Coverage

Now fire up Arcview again:

$ arcview &

Open the view that you created in the first part of the exercise with the Huc and Rf1 files on it and add the theme Albstats to it. The USGS stations from your point coverage should fall exactly on the main stem of the Guadalupe River. Pretty cool !!! This stuff really does work! Now we are going to add the USGS gage Id,gage name, and annual discharge for each gage as a new attribute in Arcview.

Creating a New Data Table Click on the Table icon in the Project Window and Select New. You will see a blank table appear. In the Table Window, Under Table, use Start Editing to initiate the editing of the new table, then under Edit Add field to create a new field in the Table. In the dialog box that comes up, type

name Number
type number
width 4
decimal places 0

You will see the new field called Number come up in the attribute table. Continue adding fields as follows:

type string
width 12

name Name
type string
width 16

name Flow
type number
width 8
decimal places 0

Once you've done this, go to Table/Stop Editing to save the new fields. If you make a mistake in adding the fields, use Table/Start Editing again and Edit/Delete Field to get rid of the field that you wish to replace. Add a replacement field. It always gets added to the right hand end of the table but you can relocate it in the table by dragging its field name to a new location. Use Table/Stop Editing to save the new table fields.

Adding Data to the Table

Use Table/Start Editing to begin adding data, then Edit/Add Record to add a record to the table. Do this seven times to create space for the data on the 7 gages. Now go to the icon bar on the top of the display and select the I button with an arrow on it (just to the right of the I button without an arrow on it).

Go down into the table and you'll see a little hand and finger appear. Use this to click on the record whose value you want to fill in and add the appropriate data value. Continue adding the data values until they are all done.

The following data are needed in the table:

Number    USGSID    Name            Flow 
1         08176500  Victoria        2095

2         08175800  Cuero           2094 

3         08168500  New_Braunfels   552 

4         08167800  Sattler         464 

5         08167000  Comfort         215 

6         08166200  Kerrville       186

7         08165500  Hunt            81

Click on any depressed field labels you have to undepress them. Then select Table/Stop Editing to close the table. Note that you can only edit tables for which you have write permission (i.e. your own tables not tables in my work area).

Joining the Data Table to the Point Attribute Table

Go to the Table icon in the Project Window again, and select Add. Choose Attributes of Albstat.

Go to the Data table and depress the Number field label. Go to the Attributes Table and depress the Albstat# field. The order in which you do this is important. You should now have two tables appearing like this:

Notice how there is a one to one relationship between the values in the Number field of the Data table and the Albstat# field of the Attributes of Albstat table. This is the key field that will be used to join the two tables together.

Use Table/Join to accomplish the Table connection. You will now have an Attributes of Albstat table that looks like this:

Some of the attribute fields (shape, area, perimeter) have been omitted from this view for clarity.

Labeling the Gages in the View

Now you can use the Name field that you've added as a label for the gages in the View. Go to the View window and under Theme/Properties select the Label symbol. You'll be prompted with a dialog box which permits you to specify what item is to be used as a label. Scroll down to select the Name field. Then use Theme/Auto Label to add the names to the view. You can use Window/Show Tool Palette with the text option to change the size of the labelings. You can use drag the labels around to get a more pleasing arrangement provided the arrow button in the View toolbar is depressed.

You can now create a view like this:

Pretty awesome!

Creating a Chart and Layout

Create a chart of the mean annual flow of the Guadalupe gages by highlighting the Attributes table, select Table/Chart in the pulldown menus, and in the dialog box that appears, Add Flow to the display and label the fields with Name. A bar chart will appear. To edit the title and axes of the chart, use the small pen tool which is third from the right in the lower tool bar in the Chart window and then click on the chart feature that you want to alter.

Prepare a layout showing a map of the drainage area, the graph of its annual flows at each gage and a table of numerical values describing the gages. If you add a table or chart and it comes up blank, check that the Display Always option is used and that the window that you have opened in the layout is large enough to display the object that is to appear in it. If necessary resize the original chart or table smaller so that it can be displayed in the layout. You'll see in the chart that the flow in the Guadalupe River at Cuero and Victoria is much higher than in the upstream stations. That is because the flow from the San Marcos river joins the Guadalupe upstream of Cuero.

To be turned in: a layout showing the base map, chart and data table for the Guadalupe River flows

Overlaying the Edwards Aquifer

The Edwards aquifer is one of the most critical water resources of Central Texas. It is the main source of water supply for San Antonio, the 10th largest city in the United States. The Edwards aquifer is recharged by infiltration from rivers crossing its outcrop area. To determine where the Guadalupe river crosses, the outcrop area, I obtained a coverage of the Edwards aquifer from the Texas Natural Resource Information System by selecting through the menu system: GIS/hydro_geology/major_aqu_e00 where the file edwards.e00 is found. I downloaded this file by logging in to TNRIS using anonymous ftp to: www.twdb.state.tx.us and changing directories to pub/GIS/hydro_geology/major_aqu_e00. Use binary in ftp before downloading files from this area. It seems that you should be able to download this from Netscape but the file displayed on the screen when I did this so I used anonymous ftp to get it directly.

The edwards aquifer coverage from TNRIS is in standard Texas State Mapping System coordinates which are presented in a Lambert Conformal Conic projection. We are using the same coordinates but in an Albers projection because it preserves earth area. I projected the edwards coverage from Lambert to Albers TSMS coordinates using the prj file Lambtsms.prj in the projection library in /res2/maidment/proj. This is the coverage Edwards that you copied from my directory at the beginning of the exercise.

Add the Edwards theme to your Guadalupe project. Click on its legend and label the theme using the attribute Aquifer. This attribute has three values: 1 for outcrop, 2 for downdip and 0 for holes within the outer boundary of the aquifer. Classify the values with Unique Value and color them appropriately.

You'll see that the Guadalupe river flows South East towards the Gulf Coast and it cross first the outcrop and then the downdip portions of the Edwards aquifer. The downdip region is where the aquifer dips below the land surface and is shielded from the surface rivers by overlying hydrogeological units of low permeability. The Edwards is a fissured limestone aquifer whose fissures lie along its Southwest to Northeast orientation, so its flow moves in that direction, transverse to the direction of flow in the Guadalupe basin. It is thus quite possible for water to drain from the Guadalupe river into the Edwards aquifer and then reappear as a spring further North in another river, such as Comal springs feeding the Comal river. Zoom in to the region where the aquifer crosses the Guadalupe basin for a closer look.

To be turned in: Between which two gaging stations does the Edwards aquifer outcrop area occur? What is the difference in mean annual flow at these two gages? Comment on these data. Do they seem correct to you?

Downloading USGS Flow Data

There are also other sources of flow data. One of them is via Internet from the U.S. Geological Survey in Texas. To retrieve stream flow data from that site go to the Online Hydrologic Data and then to the Texas Surface-water Database section. You'll see several scroll down windows which allow you to find your stations(s) by Basin, USGS HUC, County, station type or station name or number. Select the Guadalupe River Basin and Station Type Surface Waterhit "Find stations". There 99 surface water stations in the basin. Select the stations for this exercise by clicking on them. I chose the Guadalupe River at Victoria. Then click on "Get retrieval form for the selected station(s)" You now have to specify what data you want to retrieve. Select to retrieve "DISCHARGE, IN CFS FROM THE DCP" from each station, and (near the bottom of the page) specify the time interval(I selected 1/1/91 to 12/31/93 because there was a large flood in South Texas in Christmas of 1992 and I wanted to look at its flow characterstics. It is clear that the first six months of 1992 were a very wet period when compared to the corresponding periods in 1991 and 1993.

Select "Return graph". Then click on the "Make data retrieval" button (Retrieving the graph may take awhile). Pretty cool! You can also download data from this source or create graphs for different time periods. You'll eventually get a plot of Discharge vs. time for your selected station. My graph looks like this:

Print your graph from Netscape.

To be turned in: a graph of the discharge from one of the USGS stations on the Guadalupe River.

Cleaning Up

When you're done with this part of the exercise, you'll need to clean up:

Arc: kill stations all
Arc: kill albstat all
Arc: kill huctx all
Arc: kill rf1tx all
Arc: kill hucguadal all
Arc: kill rf1guad all
Arc: kill edwards all
Arc: quit

$: rm data.dat
$: rm lonlat.dat
$: rm rf1guad.* [removes several files]
$: rm hucguad.* [removes several files]
Keep your projection file albstat.prj around for future reference. Remove any other files and directories from the working directory using the rm and rmdir commands. If you want to remove all the files underneath a particular directory and also the directory itself, use

rm -R directoryname
but be very careful when you do this because it will silently kill off everything under directoryname! More efficient than James Bond!

Ok! You're done!

These materials may be used for study, research, and education, but please credit the authors and the Center for Research in Water Resources, The University of Texas at Austin. All commercial rights reserved. Copyright 1997 Center for Research in Water Resources.