[postgis-users] number format weirdness from dbfopen.c?

Stephen Woodbridge woodbri at swoodbridge.com
Sun Jul 3 09:54:33 PDT 2005


gold wrote:
> are there any open issues or common experience with some number values 
> being read incorrectly from a .dbf file? i noticed this in using 
> shp2pgsql, and i'm still trying to track it down.
> 
> basically, shp2pgsql was generating insert statements inserting values 
> like '1234.' (notice the trailing '.'). i've put extra debugging in my 
> local copy of dbfopen and shp2pgsql, and indeed this is the ascii data 
> coming from the .dbf file itself (after the whitespace trimming). the 
> fields in question are marked as type 'N', as returned by 
> DBFGetNativeFieldType.
> 
> i'm gonna write a separate low level version (bypassing dbfopen) to just 
> extract this field and at least get some degree of confirmation as to 
> whether this is really how the data is, or whether there's something 
> amiss in dbfopen (unlikely, but i should check).
> 
> i'm also going to get in touch with the data providers to see if this is 
> something they're aware of. is it possible that in the .dbf world 
> '1234.' is valid numeric syntax?

Jon,

The shapelib API document says DBF type code 'N' (Numeric, with or 
without decimal).

-Steve W.



More information about the postgis-users mailing list