[GRASS-dev] Re: Profiler updates

Hamish hamish_nospam at yahoo.com
Mon Feb 19 05:17:33 EST 2007


Michael Barton wrote:
> I implemented all your wishes below. Just committed it to the cvs. See
> what you think. I'm to sleep now.

cheers. comments follow.



Hamish wrote:
> > Currently the profile line interpolates over areas of null value.
> > It would be more correct if the line stopped and then restarted
> > when the data resumed. e.g.:
> > 
> >   http://bambi.otago.ac.nz/hamish/grass/profile_nulls.png

this is still a problem.


> > wish 1: prettify max value on x-axis:
> > +               -text "[format %g $cumdist]" \

maybe we want to improve on that more? set to %.2f then pass that string
through %g?  ie limit to 2 decimal places and strip off .00.  ??
or %.1f?  %.0f?

> > wish 2: add units to the axes.
> > # x-axis: r.profile always return meters
> > # y-axis get units (plural) from g.proj:

you are reporting the y units (from g.proj -p) on the x-axis. The
x-axis is always meters because that's what libgis returns.

For the x-axis, perhaps dist/1000 to make km if distance is >2500m?
(see crude but functional attached patch)


> > wish 3: write distance labels for ticks along the x-axis.
> > I'm not sure how to guarantee that they won't overlap if too close
> > together.

nice.


Hamish
-------------- next part --------------
Index: profile.tcl
===================================================================
RCS file: /home/grass/grassrepository/grass6/gui/tcltk/gis.m/profile.tcl,v
retrieving revision 1.15
diff -u -r1.15 profile.tcl
--- profile.tcl	19 Feb 2007 08:23:48 -0000	1.15
+++ profile.tcl	19 Feb 2007 10:13:09 -0000
@@ -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
 


More information about the grass-dev mailing list