-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create layer from delimited text (csv) does not work properly for quoted strings #14074
Comments
Author Name: springmeyer - (springmeyer -) I also meant to mention that when "a value" is imported the quotes are not stripped, as they should be. It is my understanding that quoted strings should be representing string literals so keeping the quotes after import is wrong. |
Author Name: Paolo Cavallini (@pcav)
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Chris Crook (@ccrook) Definitely an issue with CSV import! The workaround for the moment is to OGR CSV format (with a VRT file) which works just fine. Will have a look at fixing this in delimited text plugin.
|
Author Name: springmeyer - (springmeyer -) Chris Crook wrote:
Hey, thanks for commenting. I've used the VRT method and was looking for a one-step approach for novice users. I ended up solving things (for my purposes) in Mapnik by writing my own CSV plugin. So, +1 to improving this feature, but at least my original usecase is not longer critical. |
Author Name: Paolo Cavallini (@pcav)
|
Author Name: Paolo Cavallini (@pcav)
|
Author Name: Giuseppe Sucameli (@brushtyler) Fixed in changeset "230bbfb459f807a645fa3edbbc44b1012177bdfb".
|
Author Name: Giuseppe Sucameli (@brushtyler) Whether you choose only one delimiter from the "selected delimiter" list it is internally converted to "plain delimiter", so now it works also quoted strings (see #15401). If more delimiters are choosen from the "selected delimiters" list it still uses the "regexp delimiter" and it doesn't parse qouted strings. The newline problem (quoted strings on more lines are not parsed) is still there, whatever delimiter you're using.
|
Author Name: Chris Crook (@ccrook) I have an update for the delimiter plugin which fixes the newline and comma issues, but it also requires an update to the plugin dialogue which I haven't had time to complete yet. Basically the approach I am considering is to use a couple of alternative parsers - one for regexp, one for plain whitespace, and one for fixed delimiters such as CSV. I'm thinking the dialog could then be a bit simpler (for the user), with an initial selection of parser type (which could include preset types, such as Excel CSV, tab delimited), and then options displayed according to the type of delimiter set. One development issue that makes this difficult is that both the data provider plugin and the options need to access the same parsing code, but they are different compilation modules, so I haven't figured where to put the common code, or whether to just replicate it. |
Maybe the problem is back? quoted text " is ignored I am importing a CSV file with the: add layer --> delimited text menu. If you need to reproduce the problem, CSV is generated from xlsx at: Maybe not the right place to publish |
@eduardosuela can you please attach the CSV here (as zip)? thanks. |
I added a package and the files Here you are. Nombre;descripción;Código del centro;Tipo de centro;Horario atención Ciudadana;Horario especial;Alias del centro;Hospital de referencia;Horario de urgencia;LATWGS84;LONWGS84;Dirección;Comarca;Municipio;Código postal;Provincia;Teléfono;Fax;Correo electrónico Consultorio de Navaridas ;;consult_navaridas;Consultorio;"martes y jueves de 08:30 a 11:00; viernes de 12:30 a 14:30";;;Hospital Universitario de Araba;;42.543792;-2.624492;Fabulista Samaniego;OSI Rioja Alavesa;Navaridas;01309;Araba;;; Horario atención Ciudadana (opening times for citizens) contains in the last line: |
Author Name: springmeyer - (springmeyer -)
Original Redmine Issue: 4091
Affected QGIS version: master
Redmine category:c++_plugins
If you import a csv with values with commas, using 'comma' as the delimiter, only commas that are unquoted should be used to split the columns.
Right now (QGIS 1.7.0) the result of a row like:
is to split on the , between John and Doe, which is not the right behavior.
Assigning to ccrook as i see he's done some recent work on the plugin and can hopefully give feedback on this.
The reason I think getting this behavior right is critical is that most csv export software (in my case I'm using LibreOffice) is going to default to quoting strings with commas and using commas as delimiters.
The text was updated successfully, but these errors were encountered: