xcoast, ycoast, inside - Writes coast/border metafile variables

SYNOPSIS

#include "terrno.h"
#include "uif.h"
#include "etx.h"
#include "etxform.h"
#include "etmeta.h"

int xcoast(fd, xfm, sl, ss, nl, ns)
int fd;
ETXFORM xfm;
int sl, ss;
int nl, ns;

int ycoast(fd, xfm, sl, ss, nl, ns, factor)
int fd;
ETXFORM xfm;
int sl, ss;
int nl, ns;
int factor;

int inside(x, y, xx, yy)
double x[3][3], y[3][3], xx, yy;

DESCRIPTION

xcoast and ycoast write the commands required for the construction of a coast/border metafile into an output dataset. The output dataset must already be open (gopen, gpcreate) and the metafile must already have been created (gpemcreate), but not closed. These two routines do not close the metafile. fd is the file descriptor of the file containing the coast/border data (see FILES below). xfm is the earth transform to transform the latitude and longitude values of the coast/border data file into line and sample of the 'output' dataset. sl, ss are the 1-relative start line and sample of the area to cover in the 'output' dataset. nl, ns are the number of lines and samples in the area to cover.

xcoast creates the metafile at full resolution, where full resolution is assumed to be 0.5 minutes latitude. The parameter factor of ycoast allows reduced resolution. In some cases, such as a large geographical areas or areas with many coastlines, reduced resolution allows for faster processing. If factor is 0 or 1, no reduction takes place. If for example, factor is 3, every third point of the coast/border data is used.

inside is a utility function for determining if the point (xx,yy) is inside the quadrilateral formed by the points

x[0,0],y[0,0] -> x[0,2],y[0,2] ->

x[2,2],y[2,2] -> x[2,0],y[2,0] ->

RETURN VALUES

xcoast and ycoast return 0 if successful, otherwise -1 with terrno set to the appropriate error code.

inside returns an even integer when the point is outside the region, and an odd integer when the point is inside the region.

EXAMPLES

The dataset must already be open and a metafile variable must already be created but not closed.

xcoast and ycoast do not close metafile variable.

Use like:

gpemcreate(... emseti(... : xcoast(... or ycoast(... emseti(... : gpemclose(...

FILES

coastfile, include/gp.h, include/uif.h, lib/libapp.a

SEE ALSO

coast, gpemcreate, gpemclose, gpopen, gpcreate, emseti, etxll, metafiles, datasets, etx


Last Update: $Date: 1999/05/10 20:57:10 $