Hi,
The schema of a CSV file like this
"00012",012345,1234,234.65,"text"
is autodetected this way:
ogrinfo csvtext.csv -oo autodetect_type=yes -al
INFO: Open of `csvtext.csv'
using driver `CSV' successful.
Layer name: csvtext
Geometry: None
Feature Count: 1
Layer SRS WKT:
(unknown)
field_1: Integer (0.0)
field_2: Integer (0.0)
field_3: Integer (0.0)
field_4: Real (0.0)
field_5: String (0.0)
OGRFeature(csvtext):1
field_1 (Integer) = 12
field_2 (Integer) = 12345
field_3 (Integer) = 1234
field_4 (Real) = 234.65
field_5 (String) = text
It would be good to autodetect also "00012" as a string. Double quotes are
correctly stripped of from "text" so I suppose that GDAL already knows that
they are used for enclosing strings.
See
https://gis.stackexchange.com/questions/252482/keeping-leading-zeroes-in-qgis-in-big-files
-Jukka Rahkonen-
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev