The database can be used to determine and map upstream and downstream basins, or megabasins as well as catchment surface areas. To enable this, an interface was developed based on a database package (in this case Lotus Approach) which is steering external programs through simple macro's (Verheust, in prep.). Screen movies to illustrate the procedures have been developed in Lotus Screencam and can be requested from ALCOM. Lotus Screencam player can be downloaded freely from the Lotus homepage on the WWW.
The database package links all database files (in Dbase IV format) as explained in figure 1. Based on this linking, queries can be executed and subsequently mapped through simple macro's:
This macro executes the following commands:
This macro executes the following commands:
To determine upstream basins, one should query in the UP(i) field for the WS_ID of the respective basin, where “i” is the level of the respective basin. Downstream basins can be determined in the D1–D39 fields or in the DOWN_ALL field which allow a query for all the downstream watersheds. Macro's in the currently developed interface then export the WS_ID's and subsequently map the selected watersheds. Note that all WS_ID's are stored in text format in the DBF files. This is to allow export of identifiers in text format (between quotes) which is used by most mapping programs that use BNA files. An example of the approach template is included for users that have Lotus approach (of, fig. 2).
Figure 2: Main form of the database interface with mapping macro buttons
Two mapping programs are currently used by ALCOM and were integrated in the interface: Mapviewer (version 2) and Windisp (version 3),
Mapviewer is a commercially developed software package which allows fast vector mapping, and advanced mapping of features. A demo version of the program can be downloaded from the Golden Software website (http://www.golden.com). The package is relatively cheap and user friendly. Mapviewer 2 has the advantage over Windisp3 that it is faster in display and identifiers can be easily copied to the database by double clicking and CTRL-C.
A Mapviewer file (WS_SADC.GSM) has been included which loads the WS_SELEC.TXT file, colouring only the watersheds which were selected in the database and exported in the data file. This is done through the hatch map feature from Mapviewer. Mapviewer files incorporate all map items but update external data files in order to display colours or labels.
Windisp3 is a program which was developed through the coordination of many organisations such as FAO, USAID, USFS, USGS and SADC/RRSP. It is freely available and can be downloaded from WWW at http://ag.arizona.edu/~epfirman/windisp3.html. Windisp was mainly developed to visualise and analyse raster maps but also has advanced vector mapping features. It is a bit slower in vector mapping than Mapviewer since it redraws all maps based on the original components but allows also simple GIS analyses such as calculation of statistics for vector objects based on raster maps.
Two Windisp3 project files (WS_SADC.PRJ and WS_SELEC.PRJ) and a Windisp3 colour table (WS_SADC.CLR) are included (cf. fig. 3) together with a SADC country layer (DC_NAT.BNA) which allow mapping and colouring of the watersheds if one has the windisp3 software installed (RRSP, 1998). The Windisp project file will load the watershed map together with the WS_SELEC.TXT file which will colour the selected watersheds.
Figure 3: Example of display in Windisp3 indicating Zambezi and Orange basins
A custom made Qbasic program allows export of selected watersheds based on a text file (WS_SELEC.TXT) with the identifiers of these watersheds. The program (WS_SELEC.BAS) is left in source code and should be kept in the same directory as WS_SADC.BNA. Before running the program, the WS_SELEC.TXT should be modified to contain the selected WS_ID's and names. In the current interface, this is done through a macro that exports a comma delimited text file with the WS_ID, NAME1, MEGABASIN and COLOR_CODE. The program can be executed through the batch file (WS_SELEC.BAT) if qbasic.exe is copied to the database subdirectory or directory listed in the DOS path command. A program listing of WS_SELEC.BAS is included in Appendix V.
The interface was developed for a fairly strict directory structure. Windisp3 should be installed in the default directory C:\WTNDISP3, all database and map files should be installed on C:\ALCOMWRD and QBASIC.EXE should be installed in a path directory. If this is not the case, macros, maps and batch files might have to be modified in order to reflect this difference in directory or path structure.
The current database interface holds 5 different macros which can be modified through the Approach Macro/Edit command when needed. If needed, changes can be made to the directories or drives in the macro commands. In case Windisp is located in a different directory (e.g. a server drive), macro 3 and 4 will have to be changed to reflect the correct programme location. In case the main database directory or drive has been changed, all macros will need to be modified.
Macro 1: Create map worksheet
Exports c:\alcomwrd\ws\map\ws_selec.txt
Macro 2: Extract bna for selection
Runs macro 1 (create map worksheet)
Runs c:\alcomwrd\ws\map\ws_select.bat
Macro 3: View extracted watersheds
Opens c:\windisp3\windisp3.exe file open project, “c:\alcomwrd\ws\map\ws_selec.prj, 1,1”
Macro 4: View selected watersheds
Runs macro 1 (create map worksheet)
Opens c:\windisp3\windisp3.exe file open project, “c:\alcomwrd\ws\map\ws_sadc.prj, 1,1”
Macro 5: View selected watersheds in mapviewer
Runs macro 1 (create map worksheet)
Opens c:\alcomwrd\ws\map\ws_sadc.gsm
Mapviewer map files will read data from a specific directory or from the same directory as the map. Since the developed mapviewer map loads the data from the \MAP\ directory, there is no need to change mapviewer map files with regard to a change in directory structure. The GSM extension for the mapviewer maps has to be associated in Windows with the mapviewer programme in order to automatically open the map files.
Windips project files are drive and directory specific and need to be changed in case the whole database is installed on a different drive or directory. Windisp project files are in ASCII format and can be changed in notepad or most word processors.
Listing of the WS_SADC project file is as follows:
[Parameters]
Junk, Elevation,“”
Allow zoom,File Retrieve
Image,“C:\ALCOMWRD\WS\MAP\BLANK.IML,,C:\ALCOMWRD\WS\MAP\ZOOM.CLR, 0, 0, 30, 35”
Elevation,File Retrieve
Image,“C:\ALCOMWRD\WS\MAP\DEM100.IML,,C:\ALCOMWRD\WS\MAP\DEM100.CLR, 0,8,320,400”
Junk,Watersheds (WS), “ ”
Watersheds uncoloured,File Retrieve Map,“c:\ALCOMWRD\WS\MAP\WS_sadc.BNA, 0, 0, 6, 1, , , ”
WS selection coloured,File Retrieve Map,“c:\ALCOMWRD\WS\MAP\ws_sadc.BNA, 0, 0, 6, 1 , C:\ALCOMWRD\WS\MAP\WS_SELEC.TXT,COLOR_CODE, C :\ALCOMWRD\WS\MAP\WS_SADC.CLR”
WS all coloured,File Retrieve Map,“c:\ALCOMWRD\WS\MAP\ws_sadc.BNA, 0, 0, 6, 1,C:\ALCOMWRD\WS\MAP\WS_ALL.TXT,COLOR_CODE, C : \ALCOMWRD\WS\MAP\WS_SADC.CLR”
Junk, Countries, “ ”
SADC Countries,File Retrieve Map,“c:\ALCOMWRD\WS\MAP\DC_NAT.BNA, 12, 0, 6, 1,,,”
[Variables]
[Settings]
[Window1]
Allow Zoom, Y,
DEM, N,
WS uncoloured, N,
WS selection coloured, Y,
WS all coloured, N,
SADC Countries, Y,
When the drive or directory structure is changed, this should be reflected in all directory statements in the project file as listed above. The second project file, WS_SELEC. PRJ which displays the watersheds that were cut out can be modified in an analogue manner.
Only one batch file (WS_SELEC.BAT in the map directory) is currently used to cut out the selected watersheds from the main watershed BNA file. If the whole database is installed on a different drive or directory this batch file needs to be modified as well. Batch files are in ASCII format and can be changed in notepad or most word processors. Listing of the batch file is as follows:
qbasic/run c:\alcomwrd\ws\map\ws_selec.bas
Both the directory for the BAS file as for the qbasic program should be changed in this line if necessary.