v.plant	DRAFT ONLY	1

1


CSIRO Exploration & Mining	Open-file report ###	SJD Cox







Open-file report ###

v.plant:  a program to insert intermediate points on vector lines for use
with the GRASS GIS
S J D Cox
AGCRC, CSIRO Exploration & Mining, Nedlands, WA


March 1996


Summary
This report describes the use and operation of the program v.plant, used
with the GRASS GIS system.  The report contains (i) a discussion of the
problem which motivated the development of the program, (ii) a description
of the method used, (iii) the manual page describing the usage of the
program,  (iv) a listing of the source-code.
Introduction
Map projections
Projections are representations of information defined on curved surfaces
(usually spheroids) on two-dimensional surfaces.  This allows the
description of the location information in cartesian or other plane
coordinate systems.  Particular projections are defined by precise
mathematical relations, which allows conversion of maps from between
projections to be achieved using straightforward mathematical operations
[1].
Projecting line segments
When converted from one map projection to another, straight-lines become
curves.  Thus, a line segment which can be described by four parameters
only (eg the coordinates of the end points) in one projection becomes an
arc which needs more parameters in other projections.  In GIS systems which
describe arcs as a sequence of line segments, this means that intermediate
points between the ends of the segment are used.  The easiest method of
projecting a line accurately is to include intermediate points in the
description in the source projection, so that all these points are included
in the target map.
Context within the GRASS GIS
Vector maps (lines and arcs) in the GRASS GIS are represented by a
relatively straightforward format.  This is exemplified in the ascii
version of vector files, as produced by v.out.ascii [2] and described in
the programmer's manual [3].  Individual vector segments are described by a
sequence of coordinate pairs, with the number of coordinated pairs for the
segment recorded in a brief header for each segment.  The program v.prune
[4] is provided to remove points which are considered redundant through
being too close together within a segment.  v.plant has been designed as
the complement of this, to insert extra points at a specified spacing along
straight-line segments.
Design of v.plant
v.plant has been implemented as a Bourne shell script.  The basic procedure
is as follows:
1.  Write out the existing map in the dig_ascii format;
2.  Use an included awk script to process each vector segment in turn,
moving from point to point along the segment.  If a span between two
adjacent points is greater than the specified threshold (in map units)
extra points are inserted collinearly.
3.  The modified dig_ascii file is re-imported, overwriting the original file.
Because the original dig file is overwritten, all the support files are
preserved.  Since the vector segments remain in the same sequence, and all
the original points remain in the modified map, including the end-points of
each segment, all topology, attributes, etc are maintained.
The usage is exemplified in the attached manual page.  The source code is
also attached, which may be examined for a detailed understanding of the
method.
Future enhancements
A command-line version of v.plant would be highly desirable.
References
[1]	Evenden, G.I.  (1990) Cartographic projection procedures for the UNIX
environment - a user's manual.  USGS Open-File Report 90-284  (Also see
Interim Report and 2nd Interim Report on Release 4, Evenden 1994).
[2]	Higgins, M. & Westervelt, J.  v.out.ascii - Converts a binary GRASS
vector map layer into an ASCII GRASS vector map layer.  GRASS 4.1
documentation (main section).
[3]	Shapiro, M., Westervelt, J, Gerdes, D., Larson, M. & Brownfeld, K.R.
(1993) GRASS 4.1 programmer's manual.  US Army Construction Engineering
Research Laboratory.
[4]	Gerdes D.,  v.prune - Prunes points from binary GRASS vector data
files.  GRASS 4.1 documentation (main section).


