[GRASS-user] gps trajectories

Hamish hamish_b at yahoo.com
Tue Sep 22 04:36:56 EDT 2009


Bram wrote:
> The past days I have been trying to find out the best way
> to represent different gps trajectories in GRASS with the
> dates of the locations.
> 1. I used R to create SpatialLinesDataFrame and exported it
> in a shape file for GRASS.
> 2. I got stuck in GRASS, because I couldn't access the
> vertices (i.e. the points) of the different lines (for each
> individual trajectory one line). I wanted to access each point
> to be able to connect it to a database with the dates, I need
> these vertices also for subsequent operations. [is it really
> not possible to directly access and manipulate the vertices
> in a line?]
> 3. I tried "v.to.points -v" to extract the vertices, worked
> fine, I have now an object with two layers: the points and
> the individuals.
> 4. I got stuck since this new object is no longer a line,
> but a collection of points, fortunately organized in a
> hierarchical way (i.e. nested within individuals)...
> Possibly as a consequence, I could no longer easily use
> d.vect.thematic to plot the trajectories from each
> individual.
> 
> I have been looking on the web for anything useful on how
> to use GRASS for the representation of GPS trajectories,
> in vain (apart from functions to read from gps receivers,
>
> I have simple csv files for the trajectories).  Therefore, I
> am curious about the experiences of other people in this
> context.  And maybe a few tips could help me further on
> my way.


you are on the right track and figured out the root of the
problem:

- lines are of one category, and that category links to
  attributes in the database.
- points also have one category each, and those link to the DB
  as well.
- vertices (nodes of the polyline) can not have categories and
  therefore can not have attributes.

this is nothing specific to GRASS. shapefiles, PostGIS, whatever
will have the same issue.


and the solution:

- keep two map layers, one for the line, and one for the points

but converting a track line to points with v.to.points is no
good as the vertex attributes are already lost.

probably the easiest way is to import your points with
v.in.ascii and keep the line you have from R.

if starting from scratch v.in.gpsbabel with the xcsv import
filter would probably be your best bet.

Even if you don't use them, you should have a look at the
v.in.garmin and v.in.gpsbabel modules' help pages, options,
and internal method, as they essentially sove the same problem.

the "usual" method would be to run the script twice, once as
track points and once as track lines. then overplot the points
on top of the line.

One nice thing they'll probably give you which the R shapefile
won't is for each trackline a start/end time and start/end
lat-lon.


as for editing vertices, see v.edit module. (but there are no
attributes to edit). they may be individually moved with v.digit.


Hamish

ps- check out the new "ping" symbol; note grass rotation angle
is theta/math style, ie measured CCW from east. convert from
compass convention with "90-true compass heading".
     http://grass.osgeo.org/wiki/IconSymbols#New



      


More information about the grass-user mailing list