ldlg2viff(3)

LIBRARY ROUTINE
ldlg2viff - Convert a DLG format vector file to VIFF format.

LIBRARY CALL
#include "vinclude.h"
int
ldlg2viff (dlgimg, rows, cols, loc_flag,
           xv_img1, xv_img2, xv_img3, xv_img4)
struct dlgimage *dlgimg;
int rows, cols, loc_flag;
struct xvimage **xv_img1, **xv_img2, **xv_img3, **xv_img4;

INPUT
1. dlgimg - a pointer to a dlgimage structure. This
             structure should not be allocated as it
             will be in the library.
2. rows - the number of rows in the xvimage that the
             dlg data is to be rasterized and stored
             to.
3. cols - the number of columns in the xvimage that
             the dlg data is to be rasterized and
             stored to.
4. loc_flag - an integer flag which specifies the
             type of locations to be written with the
             output files. 0=no location data,
             1=sparse location data, 2=full location
             data.

OUTPUT
1. xv_img1 - a double pointer to the xvimage structure
             that is returned for the first DLG category
2. xv_img1 - a double pointer to the xvimage structure
             that is returned for the second DLG category
3. xv_img1 - a double pointer to the xvimage structure
             that is returned for the third DLG category
4. xv_img1 - a double pointer to the xvimage structure
             that is returned for the fourth DLG category

This function returns 1 on success and 0 on failure.

MODIFICATIONS

DESCRIPTION
ldlg2viff converts an optional format digital line graph file to VIFF raster format.

A DLG file may contain several categories of data. Each category contains data of different types. For instance, the first category might be roads and the second category streams. Dlg2viff will create a separate output file for each category in the in the input DLG file. The input DLG file may not contain more that four categories. Most often DLG files are created with a single category, so this should not be a problem.

This program reads the vector data (points and lines) and plots them in the viff raster output image. DLG data associates pairs of attributes with the points and lines to describe each feature. Each pair of attributes contains a major attribute and a minor attribute. For example, the major attribute may specify fresh water, and the minor attribute could specify a small stream. Each output file that dlg2viff writes will contain a separate data band for each pair of attributes that occur in its DLG category. If three pairs of attributes are present in the DLG category for roads, then the output viff file for roads will have four bands in it. The first band in an output viff image is always reserved for features with no attributes associated with them. The last three bands will each contain data associated with the three pairs of attributes. The attributes that go with each data band are stored in the map for that band. The map for each band has one row and two columns, one for each attribute, with the major attribute stored in the first column. Each attribute is stored in a short (2 byte) field.

The output images are written in bit format. This is possible because for a given band there is only one pair of attributes. For each pixel in the band, there is either a feature present for that pair of attributes or there is not. A binary 0 or 1 is suitable to represent this. The number of columns in the output images is given by the -x option on the command line. The number of rows will then be determined by the size of the geographical region covered by the DLG data. This is done automatically so the output image will be scaled correctly.

There are three options for location data in the output files which may be specified using the -l option on the command line. The default option (-l 0) is that no location data will be written. This is best when the map created is to be displayed as an image, because the location data will be ignored by most programs. The second option (-l 1) is that sparse location data will be written with the output images. Since the output images are bit overlays, there is no data associated with the zero-valued pixels in the image. All the data in the image is contained in the maps and the pixels with a non-zero value. For this reason all of the zero pixels in the image may be discarded. When sparse location data is selected, the zero-valued pixels in the image will be discarded and locations will be written for the remaining non-zero pixels. This is advantageous because of the reduced size of the output files, but requires a display package (such as xprism3) which is capable of using explicit location data. The final location option (-l 2) writes an explicit location for each pixel in the output image. The image is not thinned as in the second option. All pixels, including zeros, are saved and each is assigned a location. This option can result in very large output files.

SEE ALSO
dlg2viff(1), intro(3), vipl(3), verror(3), vutils(3) lvmapdlg(3), lvlayer(3)

RESTRICTIONS
dlg2viff can only read optional format DLG files. The DLG files are restricted to four or fewer DLG categories. This program reads fixed format data files, so it is very sensitive to correct formatting in the input DLG files.

AUTHOR
Per Lysne

COPYRIGHT
Copyright 1991, University of New Mexico. All rights reserved.