v.in.ascii (bug #5209) [was Re: [GRASS-dev] ps.map: scale wrong and
no output]
Martin Landa
landa.martin at gmail.com
Tue Nov 21 03:17:00 EST 2006
Hi,
2006/11/21, Hamish <hamish_nospam at yahoo.com>:
> 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.
ou, sorry, ... you are absolutely right...
> What seems to be needed is a G__message() or G_message_no_newline() or
> somesuch fn that doesn't terminate with a newline.
I have tried to modify error.c, there is the new G__message () fn.
Best regards, Martin
> 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
>
--
Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v_in_ascii_LL-2.diff.gz
Type: application/x-gzip
Size: 1569 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20061121/80240939/v_in_ascii_LL-2.diff.gz
More information about the grass-dev
mailing list