Opened 16 years ago

Last modified 11 years ago

#125 new enhancement

quote around char attributes in ascii files may generate problems with

Reported by: ct529 Owned by: grass-dev@…
Priority: minor Milestone: 6.5.0
Component: Vector Version: 6.2.3
Keywords: quotes, inverted commas,, text file, csv file, import Cc:
CPU: All Platform: All


Supposed you have an ASCII file (comma separated), where the first column is a character column, and is automatically generated by either R, openoffice calc, kspread, MS W Escle, or any gis package using text export. The data in each cell will be surrounded by quotes (") aka inverted commas.

If you try to load the file using the command, it returns the error "ERROR: x column is not of number type" whatever the type of the x column.

To fix the problem, you have to remove the quotes around the values in the first column. Quotes around values in other columns do not seem to be important.

It should be fixed because all of the above packages correctly export character column with quotes around the values.

Change History (2)

comment:1 by hamish, 16 years ago

Priority: majorminor
Type: defectenhancement

Using a comma as the delimiter is problematic as text phrases often contain them, eg "Spearfish, SD".

Stripping the quotes should not be the default mode because a text string could include " as a valid last char.

so if this is to happen, it should be done as an optional flag.

Alternatively we could add advice to the help page explaining the problem and asking the user to export using a less common delimiter, like "|". (not always possible if the data came from somewhere else or lacking software)


comment:2 by hamish, 11 years ago

Component: DefaultVector
CPU: All
Platform: All

parsing csv is a deceptively tricky task. there's a python library which can help pre-process your data files.


Note: See TracTickets for help on using tickets.