[gdal-dev] source csv delimiters

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Thu Sep 1 12:36:32 PDT 2022


By the documentation:

“CSV files have one line for each feature (record) in the layer (table). The attribute field values are separated by commas. At least two fields per line must be present. Lines may be terminated by a DOS (CR/LF) or Unix (LF) style line terminators. Each record should have the same number of fields. The driver will also accept a semicolon, a tabulation or a space character as field separator . This autodetection will work only if there’s no other potential separator on the first line of the CSV file. Otherwise it will default to comma as separator.”
and also:
” This driver does not attempt to support all such files, but instead to support simple .csv files that can be auto-recognised. Scripts or other mechanisms can generally be used to convert other variations into a form that is compatible with the OGR CSV driver.”

I guess that it is easiest to convert your separator into comma or semicolon and hope that they do not appear in the text. Otherwise you may need to add some double quotes as well.

-Jukka Rahkonen-


Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org> Puolesta Travis Kirstine
Lähetetty: torstai 1. syyskuuta 2022 21.07
Vastaanottaja: gdal dev <gdal-dev at lists.osgeo.org>
Aihe: [gdal-dev] source csv delimiters

Is there a way to specify the delimiters when reading a source CSV file.  The file I received uses a carrot ^ value.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220901/4a081f20/attachment.htm>


More information about the gdal-dev mailing list