[GRASS-user] Labelling in gis.m profile tool

Hamish hamish_nospam at yahoo.com
Thu Mar 8 18:20:05 EST 2007


Patton, Eric wrote:
> 
> Does the gis.m profiler now have additional labels on the x and y
> axes? I've updated to the latest cvs along with make distclean, but
> the profiler only labels the maximum and minimum on the y-axis. IIRC,
> there was some discussion between Michael and Hamish about recent
> improvements to the profiler, but I can't locate the thread.

http://thread.gmane.org/gmane.comp.gis.grass.devel/18260

> OTOH, if I've misunderstood the improvements, I'd like to file
> additional profile axis labels as a wish.

The profiler (or for that matter the GIS) has no idea what the units of
the raster map are, so the y axis can't be labeled. There is no
formalized raster map meta-data spot for that so we can't just pluck it
from the map, and assuming meters is Bad.


One thing I'd still like to see in the profiler tools is the x-axis
converted to km if the total transect distance is longer than 2500m.
(The gis function that reports distance between two points always
converts and outputs in meters, I haven't checked but I suspect that
using the Location's $mapunits as the x-axis units may be an error)

Something like this:  (needs more work)

--- profile.tcl 2007-03-06 18:15:12.000000000 +1300
+++ profile.tcl.to_km   2007-02-19 23:12:49.000000000 +1300
@@ -507,12 +507,13 @@
                -text [G_msg "distance along transect ($mapunits)"] \
                -anchor n \
                -justify center
-       
+
        # add transect segment markers
        foreach {x} $pcoordslist {
                if { $tottlength > 0.0 } {
                        set segx [expr $left + (($x * $width) / $tottlength)]
                        $pcan create line $segx $bottom $segx $top -fill grey
+                       if { $tottlength > 2500.0 } { set x [expr $x/1000.0] }
                        $pcan create text $segx $top -text "[format %g $x]" \
                                -anchor s -justify center -fill grey
                }
@@ -520,8 +521,13 @@
 
 
        # add label for total transect distance
+       if { $tottlength > 2500.0 } {
+           set x [expr $tottlength/1000.0]
+       } else {
+           set x $tottlength
+       }
        $pcan create text $right $xscaletop \
-               -text "[format %g $tottlength]" \
+               -text "[format %g $x]" \
                -anchor n \
                -justify center




Hamish




More information about the grass-user mailing list