4

I'm new to Qgis, and i'm stuck with a simple task, I have a csv file with points coordinates and i would like to connect those points in a path, I'm working with wildlife movement data. i've tried with the qgis algorithm and several plugins like Points2one, PointsToPath, and Point Connector but every time I get the same python error. This is the log:

Traceback (most recent call last):
              File "/home/gabriele/.qgis2/python/plugins/pointstopaths_v02/pointstopathsdialog.py", line 89, in accept
                points = processor.generatePointDict()
              File "/home/gabriele/.qgis2/python/plugins/pointstopaths_v02/processfeatures.py", line 52, in generatePointDict
                self.coords = self.geom.asPoint()
AttributeError: 'NoneType' object has no attribute 'asPoint'

Since I've zero knowledge of python code, what I'm doing wrong?

  • Could you post some snippets of your code? That would help in debugging. – MaryBeth Jun 6 '16 at 14:49
  • If you have imported your csv into QGIS as a points layer, you could also try using the algorithms Points to path and Convert Points to Line(s) from the Processing Toolbox. – Joseph Jun 6 '16 at 14:54
  • I've tried but i can only get this line: 'NoneType' object has no attribute 'asPoint' See log for more details – Gab Jun 6 '16 at 14:57
  • Can you share your CSV for test purposes? If all tools fail, it's most likely a data issue ... – underdark Jun 6 '16 at 16:26
2

This can happen if you import data with missing geometries. I was able to reproduce this error in Points2One with the following CSV... note the 'woot' entry which is missing data.

Place,x,y
Fibble,1.0,2.0
Flubble,-13.0,29.9
Ploot,45.2,-14.0
Woot,,
Flurb,55.5,45.5

QGIS will happily load this without warnings.

Calling Point2One on this throws a similar exception:-

File "/home/steven/.qgis2/python/plugins/points2one/p2o_engine.py", line 121, in iter_points
geom = feature.geometry().asPoint()
AttributeError: 'NoneType' object has no attribute 'asPoint'

I suspect the same thing will be happening with the other plugins.

You should make sure you :-

  • import with geometry (make sure you don't have the 'No geometry (attribute only)' selected)
  • have geometry values for ALL rows : either an x and y field, or a WKT field, and none of these fields are blank

If you're using Excel (or similar) you can use sort/filter to export a new copy of your csv with all such rows excluded, and see if that works.

  • 1
    I checked my csv file and in fact some coordinate values were missing, I excluded that rows as you suggested and now the plugins are working fine. Thank you very much! – Gab Jun 6 '16 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.