Working with transects

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 grey. 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.

d.bearing_fig1.png
Figure 1: screen plotting.
d.bearing_fig2.png
Figure 2: new vector creation.
d.bearing_fig3_0.png
Figure 3: points along  line.

Example 1:Plot a hypothetical transect; bearing 230 degrees, 1000m length.

  • Setup the display:

#plot the transect origin point:
d.vect pedons cats=91 icon=basic/box
#make a grid for illustative purposes, with origin at the point above:
d.grid size=100 -t -b origin=665736,4039451
#add a quick scale bar with the mouse:
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
#display the new vector 't1' along with its direction
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'

#setup a database connection for vector 't1' to MySQL
v.db.connect map=t1 driver=mysql database="host=localhost,dbname=test" table=t1 key=cat
#create a new table in MySQL to store information about vector 't1'
echo "create table t1 (cat int not null , primary key (cat) )" | db.execute
#upload a unique ID of each vertex to the new table for 't1'
v.to.db map=t1 option=cat

  • Extract a set of points to 't1_points' every 100m along transect vector 't1'.

#extract a new point vector along 't1' interpolating a new point every 100m, saving to 't1_points'
v.to.points -i in=t1 out=t1_points dmax=110
#the new vector 't1_points' now has two tables associated with it:

t1_points_1: layer 1

+------+
| cat  |
+------+
|    1 |
|    2 |
+------+

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
 

Attachment: