On vendredi 18 août 2017 10:59:47 CEST Rahkonen Jukka (MML) wrote: > 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.
Jukka, Add -oo QUOTED_FIELDS_AS_STRING=YES I don't remember the rationale for the default of this option to be NO. Presumably the use case while developping that was with a file generated by a CSV exporter always surrounding field content by double quotes. Even -- Spatialys - Geospatial professional services http://www.spatialys.com
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev