[Spam/Pourriel] [GRASS-dev] Re: query vector points x,y

Hamish hamish_nospam at yahoo.com
Wed Sep 27 12:57:41 EDT 2006


Damiano Triglione wrote:
> > Patton, Eric wrote:
> >> True enough. I'm not sure why v.to.db only prints a few decimal
> >> places. I'm assuming there must be some print statement within one
> >of > the c programs of v.to.db that determines this.

Hamish:
> > probably lib/db/dbmi_base/valuefmt.c
> >
> > For GRASS 6.1 I changed db_convert_value_to_string() there to do:
> >        case DB_C_TYPE_DOUBLE:
> >            sprintf (buf, "%lf",db_get_value_double(value));
> >            G_trim_decimal(buf);
> >            break;
> >
> > which helps.
> >
> > Damiano: are you using 6.1+? 6.0 will trim decimals as "%f" or so.
> > Maybe there are more places that need the above fix.
> >
> > %lf prints with double precision and G_trim_decimal() removes
> > trailing zeros.

Damiano:
> Actually I am using 6.0. So: "%f", instead of "%lf", causes the single
> (rather than double) precision in sprintf, right?

yup. So this problem should be fixed already in newer versions. (!)
%f is usually 6 numbers after the decimal place. %lf is like 28 or 32 or
something like that (too long to quickly count).

%.15g was used for a time as well.

The idea is to let easting & northing coords like 5000000.000 display
with mm precision instead of being converted to 5.000000e+06.


Hamish




More information about the grass-dev mailing list