[GRASS-dev] ps.map: scale wrong and no output

Hamish hamish_nospam at yahoo.com
Mon Nov 20 22:51:53 EST 2006


Martin Landa wrote:
> >    https://intevation.de/rt/webrt?serial_num=5209
> 
> I have tried to fix this bug (the attached patch). Is it OK? -- then I
> will commit it to CVS...


re. "column type" text, it is probably not a good idea to mix
fprintf(stderr, and G_message(). I can see why you kept the first bit
with fprintf (no newline), but the module output will look really weird
if called with the --quiet flag as only G_message() part would disappear.

What seems to be needed is a G__message() or G_message_no_newline() or
somesuch fn that doesn't terminate with a newline.

This could be used for "Percent complete:"+G_percent() as well.
Then both msgs get switched on/off together with quiet/verbose.



The following looks good to me, but to preserve precision should "%lf"
be used instead of "%f", perhaps combined with G_trim_decimal()?


Index: vector/v.in.ascii/points.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/vector/v.in.ascii/points.c,v
retrieving revision 1.21
diff -u -r1.21 points.c
--- vector/v.in.ascii/points.c  18 Oct 2006 05:09:22 -0000      1.21
+++ vector/v.in.ascii/points.c  19 Nov 2006 16:45:25 -0000
@@ -368,7 +368,15 @@
                if (strlen(tokens[i]) > 0) {
                    if (coltype[i] == DB_C_TYPE_INT ||
                        coltype[i] == DB_C_TYPE_DOUBLE) {
-                       sprintf(buf2, "%s", tokens[i]);
+                       if (G_projection() == PROJECTION_LL &&
+                           (i == xcol || i == ycol)) {
+                           if (i == xcol)
+                               sprintf(buf2, "%f", x);
+                           else
+                               sprintf(buf2, "%f", y);
+                       }
+                       else
+                           sprintf(buf2, "%s", tokens[i]);
                    }
                    else {
                        db_set_string(&val, tokens[i]);



thanks,
Hamish




More information about the grass-dev mailing list