[GRASS-user] display manager in a script

Hamish hamish_nospam at yahoo.com
Tue Mar 20 06:22:25 EDT 2007


Massimo Di Stefano wrote:
> Hi,
> i'm try to writing a script to connect grass - gps-receiver

see  http://article.gmane.org/gmane.comp.gis.grass.user/17545

it is possible to write a bash script with the x monitors (d.mon) using
sleep + test for distance change + d.redraw. (NMEA refresh is typically
1 second, and I assume you are not on an airplane, so "sleep 1" isn't so
bad)

as for Tcl, I don't think you can script the Display windows without
actually hacking a custom gis.m GUI. ie won't work as an add-on script.

 
> It take the data from a srial port ( tty.bluethout_receiver)
> visualize the output in a standard "x" monitor
> refreshing the region using a $range (distance in meters from current 
> gps point )
> 
> using "simple" monitor (d.mon x0) ,
> i'm not able to use functions like "zoom-pan-measure"
> it is possible to use a "display manager" instead of mon. x0 in a  
> bash script ? ...
> or writing an specific tcl script ?

a couple of ideas:

use "d.graph in=file.txt" + d.redraw to draw the track. You can update
file.txt with the latest coordinates, draw a track line and put a symbol
at your current position.

have gpsd log "x y" data to a file, then include that file in the
d.graph instructions:
 (see the d.polar script for more ideas about dynamic d.graph input)

d.graph << EOF
  color red
  width 2
  polyline
    `cat ${TMP}_coords`
# ...
EOF

and d.text(.*) to draw the current lat/lon/time etc.

To do a full import with v.in.ascii after each fix is too much overhead
to run every second. The old GRASS 5 sites format worked as a simple
text file so I could >> append a new point to the end and d.redraw
without much cost. I don't know how much cost it is to run v.in.ascii
for a single point + v.patch that to the full map? (but obviously much
still more than: >>file.txt + d.redraw the d.graph in=file.txt)


Running d.path with the current position as the starting coordinate
would be neat. I've just added a coor= option to d.path in 6.3-cvs which
will allow you to draw the shortest path on a road network automatically
from map coordinates.

"Soft" update/recenter the zoom/pan between redraws with the
$GRASS_REGION enviro variable + `bc` magic? (see the variables help
page).


Also there was a rumor of a gpsd plugin in the latest QGIS CVS.


good luck, I think this is a very possible a task to do (as a bash script
hack, not a real navigation suite).


Hamish




More information about the grass-user mailing list