lvslope(3)

LIBRARY ROUTINE
lvslope - Compute slope and aspect images from elevation data.

LIBRARY CALL
#include "vinclude.h"
int
lvslope(img1, slope_flag, slope_option, aspect_flag, aspect_option, no_aspect,
        img2, img3)
struct xvimage *img1;
int slope_flag, slope_option, aspect_flag, aspect_option;
float no_aspect;
struct xvimage **img2, **img3;

INPUT

    1. img1 - A pointer to the input viff structure.

    2. slope_flag - When set to 1, this flag causes the slope image to be created. 0 means no slope image is created.

    3. slope_option - Determines the form of the slope output: 0=degrees, 1=radians, 2=percent.

    4. aspect_flag - When set to 1, this flag causes the aspect image to be created. 0 means no aspect image is created.

    5. aspect_option - Determines the form of the aspect output: 0=degrees, 1=radians, 2=quadrants.

    6. no_aspect - Value given for the aspect of a flat surface. The aspect gives the direction the slope is facing. When there is no slope the, aspect is given this value to denote that it is undefined.

OUTPUT

    1. img2 - A double pointer to the slope viff structure. Only used if slope_flag is set.

    2. img3 - A double pointer to the aspect viff structure. Only used if aspect flag is set.

MODIFICATIONS

DESCRIPTION
lvslope computes the slope and aspect images from an input elevation data.

        The slope is always calculated as a positive number and represents the slope in the direction of the gradient at that point. The direction in which the slope is calculated depends only on the direction of the steepest gradient at the point. The slope may be computed in three forms: degrees, radians, and percent rise. Degrees and radians are used to measure the angle between a tangent to the surface at the point the slope is being calculated and a horizontal reference plane. Percent rise is a measure of how much the tangent rises with respect to the horizontal distance. For instance, if the tangent at a point rises 50 meters for every 100 meters horizontally, the slope is 50 percent. The form used for the output slopes is selected using the command line argument '-os'.

        The aspect of the elevation image tells which direction the slope is facing. The aspect is reported in the direction of the increasing slope. The aspect may also be calculated in three forms: degrees, radians, and quadrants. Degrees and radians give the clockwise angle between the positive x-axis (right to left on the image and east in geographical terms) and the direction the slope is facing. For instance, if the slope is facing the top of the image (north) then the aspect will be 90 degrees or pi/2 radians. When reported in quadrants, the aspect is given a value that depends on the range the direction it faces. The circle is divided into 24 regions of 15 degrees each, and the region that the aspect falls in determines the value that will be assigned to it. North is always assumed to be at the top of the image, and East is always to the right. A table of the quadrant values is given below:

    Aspect Value Range in Degrees Description
         1 353 - 7 east facing
         2 8 - 22 15 degrees north of east
         3 23 - 37 degrees north of east
         4 38 - 52 northeast facing
         5 53 - 67 30 degrees east of north
         6 68 - 82 15 degrees east of north
         7 83 - 97 north facing
         8 98 - 112 15 degrees west of north
         9 113 - 127 30 degrees west of north
        10 128 - 142 northwest facing
        11 143 - 157 30 degrees north of west
        12 158 - 172 15 degrees north of west
        13 173 - 187 west facing
        14 188 - 202 15 degrees south of west
        15 203 - 217 30 degrees south of west
        16 218 - 232 southwest facing
        17 233 - 247 30 degrees west of south
        18 248 - 262 15 degrees west of south
        19 263 - 277 south facing
        20 278 - 292 15 degrees east of south
        21 293 - 307 30 degrees east of south
        22 308 - 322 southeast facing
        23 323 - 337 30 degrees south of east
        24 338 - 352 15 degrees south of east
        25 no aspect (flat)
The form of the output aspect is selected using the '-to' command line argument.

        The input elevation file must be in viff format, and may be of type byte (VFF_TYP_1_BYTE), short (VFF_TYP_2_BYTE), int (VFF_TYP_4_BYTE), or float (VFF_TYP_FLOAT). The input data will automatically be converted to float, and both the slope and aspect output files will always be type float regardless of the input data type. Any type of map that is not forced (VFF_MAP_FORCE) is allowed on the input file, and the map will be transfered as is to the output. Explicit location data is not allowed in the input file, and will result in an error. The pixels in the input file are assumed to be evenly sampled where the sampling interval is given in the 'pixsizx' and 'pixsizy' fields in the viff header. The units used for the sampling interval are arbitrary but must be the same units that the elevations in the file use. The sampling interval is not allowed to be zero. Finally, the input file is restricted to a single image.

SEE ALSO
vslope(1), intro(3), vipl(3), verror(3), vutils(3) lvsurf(3), lvconvert(3)

RESTRICTIONS
lvslope works on input images with data types byte (VFF_TYP_1_BYTE), short (VFF_TYP_2_BYTE), int (VFF_TYP_4_BYTE), and float (VFF_TYP_FLOAT), but the type of the output image will always be float regardless of the input type. Maps on the input image will be transfered directly to the output image, but forced maps (VFF_MAP_FORCE) are not accepted. Explicit location data is not accepted. The input image is restricted to one image per file.

AUTHOR
Per Lysne

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