Re: [gdal-dev] source csv delimiters

2022-09-01 Thread Paul Harwood
The slightly pedantic answer to that is surely that if it not comma
separated, it is not a CSV file!

As far as I know - that is the approach that GDAL takes!

It is easy enough to preprocess the file. As the GDAL docs say :

"Many variations of textual input are sometimes called Comma Separated
Value files, including files without commas, but fixed column widths, those
using tabs as separators or those with other auxiliary data defining field
types or structure. 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."

On Thu, 1 Sept 2022 at 19:08, Travis Kirstine 
wrote:

> Is there a way to specify the delimiters when reading a source CSV file.
> The file I received uses a carrot ^ value.
> ___
> gdal-dev mailing list
> gdal-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] source csv delimiters

2022-09-01 Thread Rahkonen Jukka
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  Puolesta Travis Kirstine
Lähetetty: torstai 1. syyskuuta 2022 21.07
Vastaanottaja: gdal dev 
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.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev