DEPARTMENT OF THE INTERIOR U.S. GEOLOGICAL SURVEY A Collection of MAPGEN Command Files Suitable for Hacking by James M. Robb Open-File Report 89-653 This report is preliminary and has not been reviewed for conformity with U.S. Geological Survey editorial standards. The use of trade names is for descriptive purposes only and does not imply endorsement by the U.S. Geological Survey. November 1989 12 Dec 1989 U. S. Geological Survey Branch of Atlantic Marine Geology Woods Hole, MA 02543 Open-file Report 89-653 A Collection of MAPGEN Command Files Suitable for Hacking Not quite a follow-the-dots tutorial or, as the old feller said, "It ain't gonna be easy, but you can get there from here." compiled by Jim Robb I. Introduction This report is a compilation of MAPGEN command files (Unix executable files, or shell scripts) that can be conveniently modified or used as models to create plottable map-overlay files from digital marine data maintained by the USGS Branch of Atlantic Marine Geology (BAMG). It has three Appendixes: on using a DOS-based PC with Kermit as a remote terminal for the map making process; on digitizing lines from existing maps using the BAMG digitizing tables and application programs; and on Kermit scripts for automating a phone contact with the BAMG central computers. The MAPGEN map-plotting system, written by Gerald Evenden (Evenden and Botbol, 1985; Evenden, 1986; and aperiodic unpublished updates of program documentation), uses a core of about a dozen programs which create computer files of plotter- useable coordinates known as overlays from files of latitude- longitude data. The most frequently used of those programs are called mapdef, grid, coast, lines, points, and legend. Each overlay file holds a specific part of the map, such as the geographic grid, a coastline, a title, or a set of bathymetric contours. The overlay files are fed to a plotter via a program called plotter, which specifically instructs the plotter how to move its pen. Making a basemap with MAPGEN programs and a few basic geographic data files is a straightforward operation once the models are established, and the files compiled here will serve to do that quickly. Some of them embody brute-force rather than elegance, but they have worked for me. You can easily change the parameters within the basemap, geographic, and bathymetric command files, and you will quickly have your own map. The script files for trackline and sample plotting are included here as examples. The data files they were written to process are not part of BAMG's standard support-data files, and rewriting of most of these scripts will be needed for new applications. Plotting tracklines or sample locations can be complicated because of the wide variety of data formats you may encounter. By default, MAPGEN programs digest a data file with latitude, longitude, time, shotpoint, etc, fields using ^I (control eye, or tab) as the field delimiter. Point-data files (e. g., core sites) can be reformatted by using the Unix editor or they can be fed through Unix utilities such as awk or sed and piped into the plotting program. Trackline data, on the other hand, usually require elaborate editing to recast them into forms that will plot as lines with tics and annotations at selectable intervals. There is a program that was written to do this job whose use is illustrated here. You will need the documentation for the MAPGEN system (Evenden and Botbol, 1985; updated versions of MAPGEN documentation are available within BAMG from Jerry Evenden) and Unix instructions. Hampson and Wright (1988) provide examples of MAPGEN and Unix script files to do a complex map-publishing task. Helpful references for Unix programs and shell script syntax include Kernighan and Pike (1984) or Morgan and McGilton (1987). II. Organization and contents: A. The Basemap: map definition, grid, and peripheral information ddomap first step: creates a map definition file dogrid draws a latitude and longitude graticule doborder makes a border around the map doprojnote sets up a map projection label doscalbar makes a bar scale for the map doscalfrac puts a scale-fraction label on the map dover makes a creation label (office ID, directory, date, time) dotitle1 emplaces a main title dobasemap a list of the above files except ddomap so you can run them as a batch job after you set them up with the editor. B. Geography: Coastline, Rivers, and Politics docoast draws a coastline dorivers puts the rivers on your coastline dostates draws the state boundaries on the land areas doeez draws the EEZ boundary C. Bathymetric contours doconxx plots individual contours from digital data compiled for the GLORIA east-coast atlas doatconts plots bathy contours from 36oN to 42oN as a single overlay file: 20 m contour interval on shelf, 100 m on slope and rise doconshelf plots 20-m contours on continental shelf as individual overlay files doconhuns plots 100-m contours (except the even thousands) as individual overlay files doconthou plots the 1000-m contours as individual overlay files (so you can plot them in a different color docont250 plots 250-m contours (those derived for the GLORIA east-coast atlas) as a single overlay file. dolabels an example of label making using legend and zoom dogeography a batch list that puts on the coast, the culture, and the 20-m shelf and 100-m slope-and-rise contours D. Tracklines: dofarn2 plots Farnella 87-2 cruise track from merge3 navigation format using seltime doa22 plots AII-89-1 cruise track from WHOI's mbatr navigation format using seltime lines.par a parameter file dois781 plots Iselin 7807-1, illustrating extraction from a TSD file and a data set without even-interval records, where seltime is not helpful. dogy8210 a complex script sequence illustrating awk, uniq, seltime, and sed. E. Samples and Sites: dodsdpwells plots DSDP well sites dostratwells plots East Coast stratigraphic exploration wells doilwells plots East Coast oil exploration sites dongdccores plots core sites from an NGDC file; illustrates awk docores plots from NGDC core curator's file dodives plots sites from an Alvin-dive file dolegn1 plots a legend to explain the Alvin-dive symbol doemerysamps plots Emery-project (WHOI-USGS) sample sites dosedlab plots sample sites of USGS-BAMG sediment analyses dowhoicores plots sites of samples from WHOI's sediment lab archive; output of muddie, a WHOI program dodumpsite plots outline of DWD106 municipal sludge dump site F. Viewing and Plotting: preview and zoom plot-viewing programs plot970 plotter runline for Calcomp 970 III. How to use these examples: Copy the contents of the directory /eez/demo from my area on the BAMG Masscomp system (aka geosvy, or Shemp) using cp, as cp /eez/jmr/demo/*/* . or create the files for yourself by typing them into your own machine. Ensure that the script files are executable (chmod +x ddomap do*). Be sure the files are in a separate directory to isolate the map files from your other files. It will quickly be very messy if you commingle your files. Use a separate directory for each map you make. For a quick demonstration without further reading run ddomap and then dobasemap (you can type ddomap; dobasemap). View the result on your screen by using preview map.def *.ov. After it hasd finished drawing the map the screen will beep. There will be a rectangular border, a grid, and some peripheral titles. Clear the screen by pressing alt - (alt minus, both keys at once) if you are using Kermit, otherwise try alt v, or whatever your emulator package specifies to clear the screen. Then run dogeography, and again run preview map.def *.ov. The ddomap and dobasemap scripts don't require any outside data to produce a scaled latitude-longitude map graticule. The dogeography scripts require coastline data, state boundaries, rivers, and contour-line data that are resident within the BAMG computer systems. Nonetheless, they can be used as models of working MAPGEN command lines. Some pathnames of contour-line data refer to files within my home directory and will have to be modified for your situation. On BAMG's Shemp computer change $HOME to /eez/jmr to access data within my area. The first MAPGEN program to be run (mapdef, using the script file I call ddomap) calculates an x-y map matrix based on your specifications of projection, scale, boundaries, any rotation of the map, and the width of bordering areas. Mapdef creates a file containing the framework used to create plottable overlay files, but which by itself cannot be plotted. The grid, lines, and points programs, as packaged script files run subsequently, create the overlay files, which are based on the map definition in the .def file and contain the plotter instructions. To see an overlay, use preview or zoom to display it on your terminal; see remarks on those programs below. There is information in Appendix I for those using DOS-machines as terminals, using Kermit and its graphics emulations. If you run a program and then rerun it with changed input parameters (trial and error) to preview it again, the programs will overwrite old overlays, so your directory will be current. To plot as hard copy, on paper or mylar, etc., see your computer gurus and use plotter; I include runlines for the BAMG's Masscomp and the BAMG's Pacific Microcomputers, Inc. system (the unit identified as "Moe") as configured today. IV. Some notes on Unix quirks: On Unix operating systems, programs known as shells act as command interpreters. There are several shells which are very similar to each other, but which have small differences among them in the command syntax they recognize and in some of their capabilities. More than one shell is likely to be present and to operate on the same machine at the same time, so a user can invoke the one he or she wants. The most common shells are the Bourne shell and the C shell. The C shell has some conveniences (such as history and the tilde (~) as "home directory") that the Bourne shell does not have. The script files contained in this report were created on a system using a C shell as the default for users on terminals, but having a Bourne shell resident and set up to run most scripts. Some of these scripts will run under one of these shells but not the other. A pound sign (#) as the first character in an executable script file will specify the C shell. Other characters in first place invoke the Bourne shell; for convention the use of a : in first place in the scripts of this report is used to guarantee Bourne shell operation. In order to make the script file work you must make it executable. Use chmod +x filename. If you have a group of files that have a common characteristic, you can use wildcards. As these files begin with do, you can use chmod +x do* (except for ddomap, which I find convenient to keep separate). Alternatively, you can use the command sh filename, which will invoke the Bourne shell and execute the file. Within a script file a pound sign (#) as the first character on a line not the first line marks a comment. Comments retained in the script files help you modify the script for your next map. One can "comment out" some lines within a file if they're not in use; thus instructions can be kept with the file about where and how the parameters are put in. A minor complication is that the points and lines programs of MAPGEN accept commands from within a data file where an initial # is the control-line marker. A second # on those lines functions as a comment marker, however, and the part of a line following a second pound sign is ignored by the MAPGEN programs. The tilde (~), used to mean "home directory" in a pathname, is a C-shell character, and will not be recognized in Bourne- shell scripts. The $HOME notation used in these scripts is recognized by both Bourne and C shells. Unix script files execute the commands they contain one after another, line by line. However, the command lines themselves (which include any piped-in editing and filtering sequences, the program name, data filename(s), program options and parameters, and output filename, etc.) must be on a single line not interrupted by a carriage return. Long command lines that won't fit across your screen can be made continuous for the computer by terminating segments with a \ at the right end. That is, the shell command interpreter will ignore a carriage return that immediately follows the \ (see the doconhuns file below for and example). This feature is useful, but it can be a vexing source of blunders if spaces are inadvertently included or excluded, and the shell consequently misinterprets your command. Some lines in this report were made short just to fit the pages. In many of the script files that follow there is use of <mapnote ## line 1 mapdef command line with EOF directive ## line 2 W,E S,N,[centr mer] geogr bounds ## line 3 projection codes ## line 4 scale denominator ## line 5 rotation CCW degrees normally 0 ## line 6 coord pairs: lower left data area x,y in cm default 3 ## and if rotated lon-lat coords on map edges, LBRT (minxy maxxy) ## line 7 right and top margins in cm default 3 ## the EOF ends the input ## mapdef -v map.def >mapnote makes an information file Explanation: Line 1 invokes the program mapdef. The m in -mcvs means that the following name (map.def) is to be the name of the output file to be created; c means create a map definition; v means verbose; it causes messages to be sent to the terminal while the program progresses; and s means calculate the scales. The < 0 # start draw from righthand edge at bottom > > 0 > 0 0 > 0 . # close the line EOF doprojnote -- labels the projection: you have to edit this so it says the correct projection. Note the use of | to mean refer to centerline for label position. Similarly, > can be used for right or top reference in files like this (see dotitle1, below). legend -mo map.def projnote.ov < to refer to center and top of map's data area. You can change the placement using x-y coordinates (cm) of the map area. Change the coordinates and the fonts for assorted legends or labels (see dolegn1, below). legend -mo map.def title1.ov <3 # xy position; | centerline; > top edge -j c # text center-justified -p 0 # pen -t # title text U. S. Mid-Atlantic East-Coast Offshore Region . # period ends title text EOF dobasemap -- a batch-file example to get the basemap done in one command; just make sure the script files it calls hold the right stuff first. dogrid doborder doprojnote doscalbar doscalfrac dover dotitle1 B. Geography -- coastlines and other commonly displayed features: The coast program draws on specifically prepared (packed) data sets that are maintained in the /coast directory of BAMG. There are DOC files in that directory that explain its contents. docoast -- puts a coastline on the map; calls a widely-used coastline-data file assembled by the CIA. coast -mo map.def coast.ov /coast/na/cil Further note: Digitized files of coastlines, rivers, political boundaries, and of some bathymetric contour lines are maintained in the /coast directory on the BAMG Unix system. Many of those files are compressed and use the coast program for plotting. Other line-data ("vector") files for bathymetry, the EEZ boundary, and navigation files are plotted using the lines program. See examples farther below. There is an informative README file in /coast. dorivers -- rivers add interest to otherwise boring coastlines coast -mo map.def rivers.ov /coast/na/riv dostates -- adds state boundaries coast -mo map*.def coast.ov /coast/na/pby doeez -- puts that ole EEZ boundary line on the map coast -mo map.def eez.ov /coast/eez C. Bathymetric Contours: The several scripts below use different ways to get bathymetric contours. A lot depends on the data sets; at BAMG we have at least four: (1) compressed data in the /coast directory, which is part of the CIA geographic data set, at wide contour intervals; (2) Generally 250-m interval contours digitized for the GLORIA east coast atlas; and (3) 20-m continental shelf contours and 100-m slope and rise contours digitized by National Mapping Division and at the Office of Energy and Marine Geology (OEM) in Reston; (4) several 1000-m contours, ocean-or-worldwide. Please consult the BAMG Database Coordinator. Lines, such as bathymetric contours, can be plotted with coast if the data are in the coast format, as in the doconXX script below, or they can be plotted using the program lines, as in doconshelf and other files below. The lines program reads files of latitude longitude points and plots a line. (It can also annotate the data points.) It is governed by commands inserted at the beginning of and within the data stream. It reads data files in sequence, and the first data file can be a lines.par (parameter) file which contains the line- drawing commands. In the following files the function of a lines.par file is contained in the </dev/tty2 & References Cited Evenden, G. I., 1986, The MAPGEN cartographic system. in Steiger, D. ed., Proceedings 1986 Working Symposium on Oceanographic Data Systems. IEEE Computer Society, p. 239-245. Evenden, G. I., and Botbol, J. M., 1985, User's Manual for MAPGEN (Unix version): a method of transforming digital cartographic data to a map. U. S. Geological Survey Open-file Report 85-706, 58 pp plus appendixes on font codes and map projections. Kernighan, B. W. and Pike, R., 1984, The Unix Programming Environment. Prentice Hall, 357 p. Hampson, J. C., Jr., and Wright, E. L., 1988, GLORIA Atlas Preparation: a basic application of the MAPGEN mapping system as a publishing aid. U. S. Geological Survey Open-file Report 88-287, 27 p. Morgan, Rachel, and McGilton, Henry, 1987, Introducing Unix System V. McGraw Hill, 612 p. Appendix I ver. 3 MAPGEN. Kermit, and your DOS PC Some laboriously-garnered hints for more comfortable plotting A DOS-based PC with a graphics-capable screen can serve as a terminal for MAPGEN map making by telephone and will also work with the vi program on the Unix systems. The commonly used program Kermit provides emulations for VT100 (as vt102) and Tektronix 4010 terminals as well as a couple of others. The vt100 is the common default type, for both the Kermit at the PC and the Unix sign-on at BAMG. Identify your terminal session to the Unix system as a Graphon 140 at the prompt for a terminal type: at TERMINAL=?(vt100), type go. Then the Unix uses both types of signals: vt100 for text editing and Tektronix-type signals for graphics. The screen will switch into graphics automatically. When the graphics display is complete the machine beeps. After your inspection of the map, push alt- (alt minus, both keys simultaneously). The screen will flip back to the vt100 emulation for keyboard work. You can cycle the emulations through Heath-19, and VT-52, and VT102 if you continue to push the alt-. You will find the VT102 screen is best for vi. You will also find that the map graphics are held on the Tektronix screen, and you can go back and look at them. Terminal emulations at the PC end are created by Kermit or other communications software. The Kermit-provided emulation is identified on the lower right on the banner. There's no banner for graphics. The emulation is toggled through choices using the alt- keys. If the 2-part communications, text plus graphics, don't work automatically there is a way to flip between Unix TERMCAP ID's at the computer without having to logoff and logon. The Unix system communicates with terminals using individual protocols that it sets up for each session. The Unix command env will show you what kind of terminal the Unix computer thinks you are. Look at the terminal identification entries TERMCAP and TERM, using env. You can change those entries by setting up new entries and using the command source. Find the files .vt100 , .4014sm, and .go140 in /eez/jmr on Shemp and copy them to your own home directory. The dots just help hide and protect those files within the directory. Then, edit your .cshrc file to add an alias line that says alias vt 'source $HOME/.vt100', and alias tk 'source $HOME/.4014sm', or alias gO 'source $HOME/.go140'. Then the command vt, tk, or gO will substitute its terminal identification in the TERM and TERMCAP variables of the Unix environment. Then, depending on what terminal you are dealing with, you can match the emulation with the TERMCAP for these three kinds of units. To create files to change the environment where there are none to copy, logon to the Unix system identifying your session as each terminal you wish to use, and in turn, for each, redirect the output of env into temporary files (env >term1). For most systems you can look at the terminal choices available by looking at termcap in /etc. The termcap information tells the system things like the codes your cursor uses, whether your terminal backspaces, and so forth. The contents of a file created using env, under a vt100 logon, look like this: PATH=.:/eez/jmr/bin:/bin:/usr/bin:/usr/local/bin:/frmwk/gie/bin:/ usr/unify/bin:/eez/jmr/utils TZ=EST5EDT HOME=/eez/jmr SHELL=/bin/csh LOGNAME=jmr TERM=go140 TERMCAP=go|go140:co#80:li#24:am:cl=\E[;H\E[2J:bs:cm=\E[%i%2;%2H:n d=\E[C:up=\E[A:ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:us=\E[4m:ue=2\E[m :is=\E>\E[?3l\E[0m\E(B\E[?4l\E[?5l\E[?7h\E[?8h\E[?1h\EPA1k\E\\\EP B1j\E\\\EPC1h\E\\\EPD1l\E\\:ks=\E[?1h\E=:ke=\E[?1l\E>:dl=\E[M:al= \E[L:if=/usr/lib/tabset/vt100:ku=^K:kd=^J:kr=^L:kl=^H:ma=h^Hj^Jk^ Kl^LH^^:kh=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=5\EM:xn GRAPH=/frmwk/gie/graph GRAPHB=/usr/local/bin/plotter:/usr/local/lib/gfonts/:sr:/dev/tty2 Edit that temporary file to eliminate all but the TERM and TERMCAP lines and put them into the following form, with the command setenv. There are really only two lines in this file below. Each begins with setenv. Note the locations of spaces, single quotes around the TERMCAP code, and semicolons at the end of the lines. This is the file called .vt100 in the above procedure. setenv TERM vt100; setenv TERMCAP 'd0|vt100|vt-100|pt100|pt-100:co#80:li#24:cl=50\E[ ;H\E[2J:bs:cm=5\E[%i%2;%2H:nd=2\E[C:up=2\E[A:ce=3\E[K:cd=50\E[J:s o=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:is=\E>\E[?3l\E[?4l\E[?5l\E[? 7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:if=/usr/lib/tabset/vt100:ku=\E OA:kd=\EOB:kr=\EOC:kl=\EOD:kh=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EO S:pt:sr=5\EM'; The terminal definition for your session is established by using source, as source .vt100. If you must manually switch modes, for fewer keystrokes use the alias capability of Unix. Alias the string tk; preview map.def to prevv, and the string vt;vi to vv, so that by entering prevv you switch the terminal ID to tektronix and preview the overlays you wish to see; then to use vi, after you use the alt- to put your own screen in the right mode, edit your trial-and- error MAPGEN files using the vv command, which you have made equivalent to vt;vi. Here's what those alias commands, which can go in your .cshrc file, look like: alias tk 'source ~/utils/.tek4014sm' alias vt 'source ~/utils/.vt100' alias g0 'source ~/utils/.go140' alias prevv 'tk; preview map.def' alias zm 'tk; zoom map.def' alias vv 'vt;vi' Pushing DOS Without logging out of your Unix session you can switch neatly and conveniently back into your PC's DOS and use your word processor or look for a telephone number or run other programs while your Unix job is running in background. After logon to the Unix through Kermit, you can get back to the Kermit prompt with ^] (control bracket), or with control- break if your system is set up that way. You get a response that gives you no prompt, but puts the cursor at the bottom of the screen. If you push c, you get the Kermit-MS> prompt. If you wish to work with your DOS files, push p, for push, which will bring up your DOS prompt. Do your DOS work, Wordperfect or whatever it may be, and then enter exit, which will bring you back to your Unix connection through Kermit. If the Kermit-MS> prompt is on the screen while you're on line with the Unix systems, you can use the full command push. What you have done is initiated ("pushed") a second level of DOS commands on top of the first set you read into memory when you booted your machine, and when you exit you drop back down to that former level, which is operating Kermit, which is talking to Unix. This can be confusing and you can pile up several Kermits or other programs on your local machine, all working at once (or trying to), until you run out of memory. So exit, if you have pushed. In order to transfer files between your machine and the Unix machines, while in your Unix subdirectory, enter Kermit -iwx. You will get a Kermit-C> prompt from a Kermit program operating within Unix. The -iwx tells the Unix Kermit that it should be under control of the Kermit on your end, and cautions it not to overwrite any existing files. See the Unix Kermit's help file. Then enter the ^] c command for the Kermit program on your local machine. To get a file to your local disk from the Unix machine, at the Kermit-MS> prompt, enter get . To reverse the transfer, use send . The file will be transferred between the subdirectories you were logged into on each machine. You can use pathnames, and you can log a different directory or disk (to copy data to a floppy) by using the cwd (change working directory) command at the Kermit-MS> prompt. Enter finish at the Kermit-MS> prompt, and the Unix-Kermit will be turned off. Enter c to get back talking to the Unix, where you started, or bye, which will logoff the Unix, disconnect, and come back to DOS. Be aware of the two simultaneously operating programs, which are identified by their prompts, Kermit-C> and Kermit-MS>. While you're working in Unix through the Kermit connection, be careful about double pushes of the Escape key. Two escapes disconnect the phone line. If you blunder and push escape twice in sequence while you are using vi, the disconnect message from your phone will appear. Reconnect by using the space bar to move the hyphen under the connect prompt, and push return, and you will be back in your vi, but with a messy screen. Fix the screen display by pushing escape again, once, and then pushing ^l (control el) or if that doesn't work, try ^r (control r). There's a 40 or 50 page manual on disk (i.e., floppy) for the January-1988 MS-Kermit version that we have, and help files (usage kermit) for the Unix version of Kermit. Appendix II How to use the digitizing table for digitizing lines or area outlines This is a summary of a procedure and of some of the kinks for digitizing features on one map so they can be replotted to another, using equipment and software maintained by the BAMG computer group. Refer also to the digin and proj manuals on the BAMG Unix systems: use man digin or man proj on Larry. There is also a Projection Parameters report (see Evenden and Botbol, 1985, and its updates). The digitizing table in the BAMG computer user's room is wired to Larry. The program digin on Larry puts information from the digitizing table into a file in the form of table coordinates. The programs proj and toxy transform the table- coordinate file into a list of latitude and longitudes which you can use with MAPGEN or ISM. Jerry Evenden wrote the proj and toxy programs, as well as MAPGEN, and is the expert. Note before starting: this digitizing procedure requires the map projection of the map you are digitizing from: not of the map you intend to make later. There are many map projections and each commonly has choices of parameters depending on global location, country of origin, scale, variety of convention, etc. The accuracy of your digitizing job will depend on your pick of the projection and those parameters. The precision you need depends largely on the scale you wish to plot your results at, compared to the scale of the map carrying the data you are digitizing. To check the job, plot it back as an overlay, and compare it to the original map. 1. Tape map to table. Avoid the table's borders because the digitizing area of the table doesn't extend all the way to the edge. 2. Choose calibration points. These should be points on your map whose longitude and latitude you can determine. They must form a polygon which completely encloses all the area you intend to digitize. Calibration points are simplest for you to work with when they are at degree intersections (just to avoid typing complicated numbers), but the machine doesn't require that. There can be more than four points. They require no special placement; they don't have to be on the same parallels or meridians from top to bottom or side to side. The polygon can look like an irregular star. You can do a calibration grid if you want to, so long as the outer polygon encloses the area. Extra points give better statistical closure, but won't repair a wrong choice on the projection. Mark your calibration points so you will be able to relocate them with the cursor, in sequence. Write down their longitudes and latitudes for later entry into a shell script for processing. You will probably want to be able to recalibrate on the same points again, after you have blundered. 3. Logon to Larry. 4. Enter digin > datafilename. Make up a filename. 5. Digitize the calibration points in sequence. Set the crosshair on the point and push the 1 key on the cursor. It beeps at each point. 6. Push F on cursor to finish the calibration phase. 7. To start the digitizing phase, push C for point mode, where you set and choose each point, or push 0, or 1, or 2, or 3, for stream mode, which will digitize 1, 2, 5, or 10 points per second. 8. Digitize your data. For point mode push any numeric key on the cursor at each point. No beeps or no screen change will show. For stream mode, push and hold the C key while you slide the crosshair along the line. 9. To suspend digitizing at a line break, push F. To restart push a number or C, as above. To terminate push D. The F inserts a #-b, the MAPGEN code for a line break, in the datafile; for ISM usage you will have to edit those later. On termination (D), you should see the Unix prompt on the terminal screen. This is the end of the table phase. There should be a datafile of digitizer counts in your directory under datafilename. You will transform these to longitudes and latitudes using the next procedure. See the digin instructions if you have a lot of lines to digitize. There is an automatic filenaming option for repetitive operations. 10. Check the datafile; eliminate duplicate calibration points. Sometimes the cursors bounce and send multiple points for a single key stroke. Use vi or edit; look at the file you created; count the calibration points in the initial group (they will be in table coordinates) to be sure there is the proper number. Delete duplicates. If duplicate points in your data could cause a problem with your project, you might look over the rest of the data file, and you should see the toxy instructions for another solution. A few duplicate data points won't hurt most plots, but be sure to fix the calibration points. 11. Using vi or edit, make a script file (called digscrpt or whatever you want) to transform the table's x/y coordinates to lons and lats. Here is a model: # set a='+proj=lcc' proj $a < $1.dat 76dw 38d 72dw 34d 78dw 34d [The data fields must be separated 78dw 38d by a tab.] EOF This file contains a code for the projection of the map you are digitizing from (not the one you intend to make later) and the longitude-latitude coordinates of the calibration points, in the sequence they were entered. It reads your datafile and creates a new file named datafile.dat. Use DMS format for the coordinates (see the MAPGEN manual; Evenden and Botbol, 1985). The projection codes and options are in the Projection Parameters manual. End the list with EOF, as illustrated. What this script file does (for your interest, translated with some help from Jerry Evenden): # calls the Unix c-shell. (A blank first character would call the Unix Bourne shell, which uses different conventions.) set a='+proj=lcc' sets a Unix variable (to save some typing). The a, as set, is substituted by the system for the $a's where they appear in the next line, and the filename you specify is substituted for the $1. In this example +proj=lcc specifies the projection: lcc=lambert conic conformal. Other examples, assuming you can accept defaults, follow: (Do check the Projection Parameters report; see Evenden and Botbol, 1985, and its unpublished updates.) lambert equal area: set a='+proj=laea +lat_0=0n' utm: set a='+proj=utm +lon_0=75w' [75w is the central meridian; specify yours; but there are conventions; read the Projection Parameters section of Evenden and Botbol (1985) so you get it right.] albers equal area conic: set a='+proj=aea' mercator: set a='+proj=merc' Note that any options required to describe the projection are to be included within those single quotes. The program proj reads the projection and calibration points as far as the EOF, puts them into a rectilinear x-y coordinate system and sends them to the program toxy (the - after toxy tells it to read the piped-in data before it reads the datafile (the $1) in its command line. Toxy reads the datafile, compares the table counts of calibration coordinates at the top of that file and the list of x-y coordinates that were piped in, and transforms the data coordinates into the x-y system. Then, in turn, another proj operation inverts the x-y data into latitudes and longitudes. Clear and simple, huh? The final product goes into a .dat file (>$1.dat); but you can change that suffix if you don't like .dat. See the documentation of the proj and toxy programs for explanation of options. 12. Make your script an executable file. Enter chmod +x digscrpt. 13. Execute the script file by entering digscrpt datafilename. Datafilename is the file that you created with digin. You will get another file, datafilename.dat. 14. MAPGEN, using its default format, requires tabs (^I in ascii) to separate fields in data files. You may want to change the format of the data in the .dat file so the longitude and latitude are separated by a tab, rather than a space. In vi, use :1,$s/ /^I/, where ^I is the tab key. If the version of proj you are using gives you a tab, you're all set. For ISM you may have to edit the tabs to blanks and the break points (#-b) to whatever ISM calls for. 15. For a MAPGEN overlay, run the lines or points program, as: lines -mo map.def overlay.ov lineoptions.par datafilename.bat 16. Good luck. Appendix III Kermit script files for use with ATT 7404 or 7406 telephone instruments to connect with Shemp, Vax, Mips within the BAMG telephone system The following are Kermit script files that will connect your PC as a terminal to the Vax or Microvax. When they work they're quicker than typing. Sometimes they don't work because the phones or the machines are slow and kermit times out, or because they encounter an unusual response. Place the following sets of files on your PC in the same directory as your kermit.exe file. The batch files (.bat) invoke Kermit and use its "take" function to call the .fil files which hold the kermit scripts. I. vax.bat @echo off kermit -f vax.fil II. vax.fil comment start of file comment kermit script file for network phone logon comment usage kermit -f vax.fil clear set speed 9600 set port 1 set input timeout-action quit echo Going for Vax via network phone connection... output \13 pause 0 output \13 pause 0 output \13 pause 0 output \13 input 5 DIAL output 300\13 comment ;avoiding entire derailing by the occasional comment ;status prompt without a login prompt SET INPUT TIMEOUT-ACTION PROCEED INPUT 1 STATUS OUTPUT \13 SET INPUT TIMEOUT-ACTION QUIT pause 0 output \13 input 5 Local echo echo There's the phone box... echo Now for the Vax... echo pause 2 comment connect on whsys as the box's default output connect\13 input 5 User output your_sign_on\13 input 5 password output your_password\13 comment comment ..This is an alternative if you want to keep a secret comment ..word out of your PC file. Replace the your_password comment ..lines with the following lines that request your comment ..password from the keyboard. comment comment echo Enter the Password: comment output @CON comment echo echo OK, Wait for vax inquiry and prompt... echo comment wait for vax set term/inquire... comment respond esc [ 6 ; 2 c (say we are vt102). comment note syntax for question mark and semicolon input 18 \27Z echo echo Vax's terminal-inquiry signal received... echo Responding, wait for the prompt... output \27[\{63}6\;2c input 15 $ echo echo There's the prompt... Go... pause 3 connect comment EOF III. mips.bat @echo off kermit -f mips.fil IV. mips.fil comment start of file comment kermit script file logon to Mips via Network phone server comment and whsys vax. comment usage kermit -f mips.fil or use mips.bat which says that. clear set speed 9600 set port 1 set input timeout-action quit echo Going for Vax via network connection... output \13 pause 0 output \13 pause 0 output \13 pause 0 output \13 input 5 DIAL output 300\13 comment ;avoiding derailing by the occasional status prompt comment ; without a login prompt SET INPUT TIMEOUT-ACTION PROCEED INPUT 1 STATUS OUTPUT \13 SET INPUT TIMEOUT-ACTION QUIT pause 0 output \13 input 5 Local pause 0 echo Got the network server; Now for the Vax at Whsys... comment connect to whsys by default output connect\13 input 5 User output your_sign_on\13 input 5 password output your_password\13 comment comment echo Enter the Password: comment output @CON comment comment wait for vax set term/inquire... comment respond esc [ 6 ; 2 c (say we are vt102). comment note syntax for question mark and semicolon input 18 \27Z echo Got the Vax's terminal inquiry signal... echo Responding, wait for prompt... output \27[\{63}6\;2c input 15 $ echo Got the Vax prompt, Now going for Mips connection... output set host mips\13 input 10 User echo Aha! The Mips speaks... echo output your_sign_on\13 input 3 password output your_password\13 echo OK, Wait for microvax inquiry and prompt... comment wait for vax set term/inquire... comment respond esc [ 6 ; 2 c (say we are vt102). comment note syntax for question mark and semicolon input 18 \27Z echo OK, Got the Microvax's terminal inquiry signal... echo Responding, wait for the next prompt... output \27[\{63}6\;2c input 15 $ echo There it is.. Go... pause 5 connect comment EOF V. shemp.bat @echo off kermit -f shemp.fil VI. shemp.fil comment kermit script file for masscomp logon comment usage kermit -f shemp.fil clear set speed 9600 set port 1 set input timeout-action quit echo echo Telephoning Shemp... output \13 pause 0 output \13 pause 0 output \13 pause 0 output \13 input 5 DIAL pause 0 output 372\13 comment ;avoiding derailing by the occasional status prompt comment ; without a login prompt SET INPUT TIMEOUT-ACTION PROCEED INPUT 1 STATUS OUTPUT \13 SET INPUT TIMEOUT-ACTION QUIT input 5 login: pause 0 output your_sign_on\13 pause 1 set input echo off input 5 Password comment echo Enter the Password: comment output @CON output your_password\13 set input echo on clear input 5 TERM comment the go response here invokes a graphon 140 termcap comment for vt100 respond with carriage return (\13) only. output go\13 connect comment EOF