Submitted by dylan on Mon, 2005-12-05 01:12.
Figure 1: screen plotting.
Figure 2: new vector creation.
Figure 3: points along line.
Transects are often used to better understand local variation in soil properties. Planning and mapping a transect in the office can make time spent in the field more efficient. Sometimes we return from the field with a transect starting point and bearing (CCW from north) of travel. Accurate digitizing of this information can often be time consuming when multiple transects are involved.
The command d.bearing can facilitate rapid planning, visualization, and digitization of transects given the parameters: origin=x,y, theta=bearing, radius=length_of_transect. The following examples illustrate some common methods of working with transect data. Command names are in boldface and comments are in . The source code for d.bearing is attached at the bottom of this page. Unarchive in the grass6/display/ directory of the GRASS61-CVS source code directory.
Example 1: Plot a hypothetical transect; bearing 230 degrees, 1000m length.
- Setup the display:
d.vect pedons cats=91 icon=basic/box
d.grid size=100 -t -b origin=665736,4039451
d.barscale -m
- Plot the transect to the screen. (Figure 1)
d.bearing origin=665736,4039451 theta=230 radius=1000 col=blue
Example 2: Make a permanent vector 't1' of the same transect.
- Replot the transect, this time saving the transect line to a new vector called 't1'
d.bearing origin=665736,4039451 theta=230 radius=1000 col=blue output=t1
- Setup the display again, this time plotting the new transect vector 't1'. (Figure 2)
d.erase
d.grid size=100 -t -b origin=665736,4039451
d.vect pedons cats=91 icon=basic/box
d.vect t1 col=blue disp=shape,dir
Example 3: Create a new vector of points every 100m along the transect 't1'.
- Assign unique IDs to the vertices of transect vector 't1'
v.db.connect map=t1 driver=mysql database="host=localhost,dbname=test" table=t1 key=cat
echo "create table t1 (cat int not null , primary key (cat) )" | db.execute
v.to.db map=t1 option=cat
- Extract a set of points to 't1_points' every 100m along transect vector 't1'.
v.to.points -i in=t1 out=t1_points dmax=110
| t1_points_1: layer 1 |
t1_points_2: layer 2 |
+------+
| cat |
+------+
| 1 |
| 2 |
+------+
|
+------+------+------------------+
| cat | lcat | along |
+------+------+------------------+
| 1 | 1 | 0 |
| 2 | 1 | 100.000000000004 |
| 3 | 1 | 200.000000000007 |
| 4 | 1 | 300.000000000011 |
| 5 | 1 | 400.000000000015 |
| 6 | 1 | 500.000000000019 |
| 7 | 1 | 600.000000000022 |
| 8 | 1 | 700.000000000026 |
| 9 | 1 | 800.00000000003 |
| 10 | 1 | 900.000000000034 |
| 11 | 1 | 1000.00000000004 |
+------+------+------------------+
|
- display our new point vector 't1_points', labeling the new ID numbers stored in layer 2. (Figure 3)
d.vect t1_points icon=basic/point size=10 fcol=red col=red disp=shape,cat llayer=2