[GRASS5] [bug #2098] (grass) pg.in.dbf truncating or rounding real numbers

Request Tracker grass-bugs at intevation.de
Fri Sep 12 15:31:34 EDT 2003


this bug's URL: http://intevation.de/rt/webrt?serial_num=2098
-------------------------------------------------------------------------

Subject: pg.in.dbf truncating or rounding real numbers

Platform: other
grass obtained from: Other (CDROM etc)
grass binary for platform: Compiled from Sources
GRASS Version: 5.0.2

I was importing into PostgreSQL a dbf file of points with UTM values for x and y coordinates. 
These did not plot correctly in d.site.pg. I discovered that the UTM coordinates were truncated. I 
had used UTM coordinates to 2 decimal places to identify coring locations. After some 
experimentation, I discovered that if the value is a real number, pg.in dbf pads it with a lot of 
zeros to the right. When the real number is over a total of 7 places, it rounds to the nearest 7 
places when being inserted into PostgreSQL. Hence, a UTM of 7350250.57 becomes 7350251. I 
have no idea what is causing this. I can see nothing obviously awry in the PostgreSQL 
configuration (4 byte real numbers) or insert statement that flashes by in pg.in.dbf that should 
cause this.

A workaround is to make the long real number a text field in the dbf file. It becomes a text field 
in PostgreSQL, preserving all meaningful digits. However, d.site.pg will still read it correctly 
when specified as an x or y coordinate.

-------------------------------------------- Managed by Request Tracker




More information about the grass-dev mailing list