Details Ticket 1401


Comment | Reply | Take | Open


Serial Number 1401
Subject possible d.legend enhancements?
Area wish
Queue grass
Requestors ihatejunkyabastards@yahoo.com
Owner none
Status resolved
Last User Contact Fri Nov 29 02:04:14 2002 (6 yr ago)
Current Priority 30
Final Priority 70
Due No date assigned
Last Action Fri Nov 29 09:42:03 2002 (6 yr ago)
Created Fri Nov 8 04:32:25 2002 (6 yr ago)

Transaction History Ticket 1401


Fri, Nov 8 2002 04:32:25    Request created by guest  
Subject: possible d.legend enhancements?

Platform: GNU/Linux/i386
grass obtained from: Mirror of Trento site
grass binary for platform: Compiled from Sources
GRASS Version: 5.0.0

Several wishes here, but they are all related.

When using d.legend with floating point rasters, the legend goes from smallest
value at the top to largest at the bottom. While this is proper for category
values, it seems backwards for typical floating point data. I am mostly thinking
about elevation scales, but I think it holds for most physical data.

It would be nice if d.legend checked to see if the raster was int or float, and
flip the output accordingly for floats. I'd guess this is what people would want
most of the time, but for when it wasn't the desired output, maybe have the user
set the first corner down lower on the screen than the second corner, which would
have the effect of flipping it again (both to reverse integer category legends
or floating point data legends)
eg
flip = 0;
if( isfloat(rast) ) { flip = 1; }
if( corner1_y > corner2_y) { flip = !flip; }




It would aslo be nice if the floating point legend didn't always report to six
decimal point accuracy, as it is more information than is usually relevant, and
clutters the display.

I propose the following:
  For data ranges greater than 25, no decimal points would be used.
  eg Legend: 0 100 200 300 400

  For data ranges more than 2.5, but less than 25.0, one would be used.
  eg Legend: 0.0 1.0 2.0 3.0 4.0

  For data ranges more than 0.25, but less than 2.5, two would be used.
  eg Legend: 0.0 0.10 0.20 0.30 0.40

and so on.


here's a little C program to demonstrate how this could be easily done:

#include <stdio.h>
#include <math.h>		// gcc -lm

int main() {
	float rangeMax = 2.54, rangeMin = 0.0;
	int SigDigits;
	char DispFormat[5];	// %.Xf\0

	SigDigits = ceil(log10(fabs(25/(rangeMax - rangeMin))));
	if(SigDigits < 0) { SigDigits = 0; }
	sprintf(DispFormat, "%%.%df", SigDigits);

	printf(DispFormat, rangeMax);
	printf("\n");
	printf(DispFormat, rangeMin);
	printf("\n");

	return 0;
}



Yet another point for refinement might be to extend the range limits up to nice
round numbers, so instead of 0.213455 -> 91.435678 the legend text would go 0
-> 100. ??

Maybe instead take the range from the top line of the color map file in $MAPSET/colr?
(to allow refinement by the user)

A 'at=x1,y1,x2,y2' command line option would be nice too, to make the module
scriptable and repeatable (eg for multiple hardcopies).


cheers,
Hamish
<ihatejunkyabastards@yahoo.com>
Fri, Nov 29 2002 02:04:14    Mail sent by guest  
All that and more is in the new version now in CVS, so this bug is resolved.
Hamish

Fri, Nov 29 2002 09:42:03    Status changed to resolved by mneteler  
Comment | Reply | Take | Open

You are currently authenticated as guest.
[Show Configuration] [Login as another user]

Users Guide - Mail Commands - Homepage of RequestTracker 1.0.7 - list any request