GIF Plotter Driver
==================

Summary
-------
The GIF plotter driver provides a mechanism to produce GIF files directly 
from within Arc/Info or to convert .gra files to .gif files. This will 
find applications in producing maps for  WWW pages or WWW servers using 
Arc/Info to create maps on the fly. This package is public domain and is 
available free of cost.

Current Solution
----------------
The solution most commonly used is to generate a postscript output and 
then use ghostscript to convert it to GIF. This involves a few extra 
steps. Besides, I have had trouble in setting my own page size. Other 
alternatives include using xv to grab a map window followed by judicious 
trimming. This cannot be used for dynamically generated maps.
The GIF plotter driver allows you to specify the picture size and fits 
well with the Arc/Info software model.

Implementation
--------------
The procedure for writing your own plotter driver is described in the 
Graphics Device Interface section of the online help manual. My initial 
attempts to write one did not get anywhere because I seem to need a 
FORTRAN compiler, an ANSI C compiler and had to code a few graphics 
routines from scratch. There may be a way to write a plotter driver 
without involving FORTRAN but I havent found one. A few public domain 
packages came to the rescue here - the recently released gnu FORTRAN 
compiler g77, the gnu ANSI C compiler gcc and the Quest GIF library gd.
The GIF plotter driver was written these three packages and the sample 
files that come with Arc/Info. The main.f and upgsys.c files are the ones 
to be modified.

How to create it
----------------
The program is distributed in two different ways. The first package 
consists of the following files.

GNUmakefile     Makefile for creating the executable
rtagif.f        The main routine in FORTRAN. This replaces the main.f
                file mentioned in the online help.
updgif.c        This replaces the updsys.c file mentioned in the online
                help
plrtagif.aml    Arc/Info plotter support files
plrtagif.menu   Arc/Info plotter support files
rungif.sh       Sample shell file to be run from Unix prompt
rtagif.doc      This document itself.

The second form is identical to the first one except that is also 
contains the executable called rtagif linked for HP7XX systems. If you 
need it for a different platform or you want to change the source code, 
you will have to link it yourself.
If you intend to link it for your machine, you will need a FORTRAN 
compiler, an ANSI C compiler and the gd graphics library. The first two 
can be the g77 and gcc packages respectively which are freely available 
on the net at your local GNU site. The g77 package is relatively new and 
may not yet be available on all gnu mirror sites. The gd library is also 
easily available at ftp://isis.cshl.org/pub/gd/gd1.2.tar.Z. You will also 
need the Arc/Info runtime library. It may be necessary to use Arc/Info 
version 7.0 but I dont know much about version 6.
The procedure for creating your own plotter driver are detailed in the 
Arc/Info online help manual. Look for it under System Administration -> 
Graphic device interface -> Writing your own plotter driver.

How to use it
-------------
The driver can be used in two ways - called within ArcPlot or stand-alone 
from the Unix prompt.
To run it at the Arc prompt, set up the driver according to the 
instructions in the Arc/Info online help manual. A few AMLs to pop up 
screens for entering the file name and picture size are in the 
distribution. Use the PLOT command and specify a file name. I used a non-
existent printer called dummy. This works except for an error message by 
lp complaining about the non-existent printer. If you find a way around 
this let me know.
The other way to run it is from the Unix prompt. See the script rungif.sh 
to see how to do this. In this mode it works like a .gra to .gif 
converter. Note that you must have an Arc/Info licence for this to work.
It is important to match the page size in the .gra file to the GIF 
picture size to avoid clipping or patches of black. The resolution of the 
GIF picture is set to an arbitrary value of 100 pixels per inch. So for a 
640 x 480 pixel GIF set a page size of 6.4 by 4.8.

Possible Improvements
---------------------
As this is my first attempt at writing a plotter driver, I would like to 
see some suggestions or criticisms from experienced plotter driver 
writers. The user interface files were hurriedly put together as we 
hardly ever use them. An improved version would be most welcome. I 
havent got access to a public ftp site so volunteers for this are 
welcome. If you have made changes or created executables for other 
platforms, you could pass it on to the ftp site, if and when there is 
one. I have a suspicion that the only FORTRAN module can be rewritten in 
C. If any of you know how to, please let me know. This could eliminate 
the need for a FORTRAN compiler thus simplifying the linking process. 
Support for interlaced and transparent GIF files can be added.

Copyrights
----------
The software is public domain(free) for non-commercial use.
The gd graphics library is copyright Quest Protein Database Center, Cold 
Spring Harbor Labs. The g77 and gcc packages are copyright Free Software 
Foundation. The Arc/Info runtime libraries are covered by licence 
agreements for the Arc/Info package.
Whatever little thats left is copyright Roads and Traffic Authority, New 
South Wales, Australia. Permission to copy or distribute this work is 
granted for non-commercial purposes.
If you use it you may choose to give credit to the Roads and Traffic 
Authority, New South Wales, Australia. This may range from mentioning us 
in large font on your web pages to sticking your head out of your office 
window and shouting Thanks, RTA!. If you choose the later option it is 
not obligatory to have it witnessed by a public notary. As the gd 
graphics library from Quest Protein Database Center, Cold Spring Harbor 
Labs forms a vital part of the package you may also wish to give them 
credit. The same goes for the gcc and g77 packages from the Free Software 
Foundation.

Applications
------------
The Roads and Traffic Authority looks after roads and licensing in the 
state of New South Wales. The Spatial Information Systems Section 
provides several GIS related services within and external to the 
organisation. One of the services is to make a wide variety of maps 
available to users within the organisation. As there are about 20 themes, 
10 possible subsets for regional and zonal offices, two  
projections(Lamberts and Geographic) and two precisions(double for the 
Arc/Info users and single for the ArcView users), there are over several 
hundred Arc/Info format export files to choose from. An internal WWW 
server was set up to provide a user-friendly method of zeroing in on the 
right export file. Thumbnail maps for each theme appear on some pages. 
When a theme map is changed, all subsets of it and the relevant HTML 
pages are updated with a single command using the Unix make utility. The 
only problem was to generate the thumbnail maps without manual 
intervention. This is where the need for a plotter driver arose.
The WWW server soon expanded to provide several other applications. 
Besides the application described above, there are other data browsers 
which dynamically generate WWW pages after combining textual data stored 
in Oracle databases and maps stored in Arc/Info by running Arc/Info and 
Oracle scripts in response to HTTP requests.

If you find this package useful or have made modifications to it or have 
suggestions for improvement and you feel like telling us, you can email 
us at prashb@rta.nsw.gov.au.

Prashant Bhandary
Spatial Information Systems Section
Roads and Traffic Authority
New South Wales, Australia
prashb@rta.nsw.gov.au

