Skip to content
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

Processing does not accept anymore CSV as input layers #19723

Closed
qgib opened this issue Oct 19, 2014 · 14 comments
Closed

Processing does not accept anymore CSV as input layers #19723

qgib opened this issue Oct 19, 2014 · 14 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Oct 19, 2014

Author Name: Giovanni Manghi (@gioman)
Original Redmine Issue: 11447
Affected QGIS version: master
Redmine category:processing/core
Assignee: Victor Olaya


On master it returns an error (here an example with a qgis tool, but happens also for other toolboxes)

Traceback (most recent call last):
  File "/usr/share/qgis/python/plugins/processing/gui/AlgorithmExecutionDialog.py", line 198, in accept
    if checkCRS and not self.alg.checkInputCRS():
  File "/usr/share/qgis/python/plugins/processing/core/GeoAlgorithm.py", line 382, in checkInputCRS
    crs = dataobjects.getObject(item).crs()
AttributeError: 'NoneType' object has no attribute 'crs'

while it works fine on 2.4 and older.


@qgib
Copy link
Contributor Author

qgib commented Oct 22, 2014

Author Name: Salvatore Larosa (@slarosa)


just tried and it has worked. Could you re-try it?


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Oct 22, 2014

Author Name: Giovanni Manghi (@gioman)


right, I don't know why but now it works.


  • status_id was changed from Feedback to Closed
  • resolution was changed from to worksforme

@qgib
Copy link
Contributor Author

qgib commented Nov 3, 2014

Author Name: Olav Peeters (Olav Peeters)


I'm having the same issue with a text (csv) file on both the 2.6 release and 2.7.0-Master Master (a68958f). I don't think the issue is solved..

@qgib
Copy link
Contributor Author

qgib commented Nov 3, 2014

Author Name: Giovanni Manghi (@gioman)


Olav Peeters wrote:

I'm having the same issue with a text (csv) file on both the 2.6 release and 2.7.0-Master Master (a68958f). I don't think the issue is solved..

can you attach a sample of a csv file of yours causing this issue? thanks.

@qgib
Copy link
Contributor Author

qgib commented Nov 4, 2014

Author Name: Olav Peeters (Olav Peeters)


see attached
the geometry is in EPSG:31370
Thanks!


  • 8018 was configured as NET60_2013_O3.7z

@qgib
Copy link
Contributor Author

qgib commented Nov 4, 2014

Author Name: Giovanni Manghi (@gioman)


Olav Peeters wrote:

see attached
the geometry is in EPSG:31370
Thanks!

right, it seems that the issue has not been fixed after all... (works fine until 2.4).


  • resolution was changed from worksforme to
  • fixed_version_id was changed from Version 2.6 to Version 2.8
  • status_id was changed from Closed to Reopened

@qgib
Copy link
Contributor Author

qgib commented Nov 21, 2014

Author Name: Olav Peeters (Olav Peeters)


I tested this on Windows, Linux (Fedora 20) and Mac OS X 10.9. Funny thing is that QGIS 2.6 on Windows and Linux have the same problem but on Mac OS X (the William Kyngesburye build) it does not. The python version in the three cases were the same.

It probably is related to one of the CRS checks changes here: https://github.com/qgis/QGIS/commits/master/python/plugins/processing/core/GeoAlgorithm.py
my guess would be this:
#b114085257d621c230db01d070b2e87b5db0c2fb

@qgib
Copy link
Contributor Author

qgib commented Nov 21, 2014

Author Name: Victor Olaya (@volaya)


hmm, there is some confusion here

If a layer is a csv, then it has no geometry. QGIS will load it as a simple geometry-less layer, which is just a table. Processing will not let you use such a "layer" as input when a vector layer is needed. You can convert your table to a real points layer using any of the algorithms in Processing that do it.

Now, to leave those csv layers out, a basic check is done, leaving files with csv extension out. Yours has txt extension, so it's passing that filter. I will change the check so it filters based on the presence/absence of geometries, so it is more robust.

This is what, at first sight, i guess is happening, but i will try to investigate with more detail

Hope this helps

@qgib
Copy link
Contributor Author

qgib commented Nov 21, 2014

Author Name: Victor Olaya (@volaya)


Sorry, my fault. The text file can have geometry if loaded as such using the "open delimited text layer"

By fixing the check as i explained, the issue should be fixed anyway, since it will be able to identify it as a valid vector layer when retrieving it to check the crs (now the method that should return the layer is returning None, since it cannot find the layer correctly)

it should be an easy fix

@qgib
Copy link
Contributor Author

qgib commented Nov 21, 2014

Author Name: Victor Olaya (@volaya)


it turns out that the problem is much more complex :-(

When opening a delimited text file, the data source uri contains semicolons, which are also used by Processing to separate multiple file inputs. Not so easy to fix...

@qgib
Copy link
Contributor Author

qgib commented Nov 21, 2014

Author Name: Victor Olaya (@volaya)


I have added the patch that fixes it, but only when the csv files are used in single inputs, not in multiple inputs

@qgib
Copy link
Contributor Author

qgib commented Nov 21, 2014

Author Name: Giovanni Manghi (@gioman)


Victor Olaya wrote:

it turns out that the problem is much more complex :-(

When opening a delimited text file, the data source uri contains semicolons, which are also used by Processing to separate multiple file inputs. Not so easy to fix...

this explain why with certain CSV works and others don't...

@qgib
Copy link
Contributor Author

qgib commented Feb 12, 2015

Author Name: Giovanni Manghi (@gioman)


the attached file works ok on qgis master, in case of multiple inputs we should document the limitation when the separator is the semicolon, and suggest resave the files with another separator. Please reopen if necessary.


  • resolution was changed from to fixed/implemented
  • status_id was changed from Reopened to Closed

@qgib
Copy link
Contributor Author

qgib commented Jun 7, 2015

Author Name: Giovanni Manghi (@gioman)


  • category_id was changed from 94 to Processing/Core

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms labels May 25, 2019
@qgib qgib added this to the Version 2.8 milestone May 25, 2019
@qgib qgib closed this as completed May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

No branches or pull requests

1 participant