[GRASS-user] Vector import combo: db.in.ogr/v.in.db data type casting problem

"Peter Löwe" peter.loewe at gmx.de
Mon Aug 20 06:56:27 PDT 2012


hi,

here is an issue (probably float/integer typcasting related) issue when importing a large CSV dataset of vector points into GRASS6.4.2.

The data set contains hundreds of columns, so v.in.ascii is not an option (the columns option-string would be ungodly long).

Instead, the data is transformed into a DBF and ingested as a table:

db.in.ogr dsn=FOO.dbf output=BAR key=the_id [works]

The integrity of the column data types is confirmed by:

db.describe -c BAR 

Result:

column:N1  [X column]
description:
type:DOUBLE PRECISION
len:20
scale:6
precision:18

column:N2  [Y column]
description:
type:DOUBLE PRECISION
len:20
scale:6
precision:18


Now a VECTOR is created from the table:

v.in.db table=BAR x=N1 y=N2 key=the_id output=BAZ --o 

[**Something strange happens at this point: Typecasting bug ? **]

Running a v.db.select over the new vector shows __INTEGER__ values for the X/Y columns N1 and N2 (which were originall EPSG lat/lon FLOAT values):

N1|N2|N3|N4
-9293467|43013833|33.4|1
-9293815|43004851|34.3|1
-9294164|42995869|41025|1

The data in column N3 is CHAR, so it only mimicks float values.


Does anybody know of a working recipe to avoid this FLOAT->INTEGER problem ?


peter

Peter
-- 
Dr. Peter Löwe
<peter.loewe at gmx.de>







More information about the grass-user mailing list