lftools icon indicating copy to clipboard operation
lftools copied to clipboard

Merge lines in direction error

Open AlisterH opened this issue 2 years ago • 4 comments

Merge lines in direction produces this rather incomprehensible error if there is a line that starts and ends at the same point:

Calculating feature informations...
Merging lines...
Saving output...
Traceback (most recent call last):
File "C:\Users/alister/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\lftools\processing_provider\Vect_DirectionalMerge.py", line 334, in processAlgorithm
fet.setGeometry(QgsGeometry.fromPolylineXY(item[0]))
TypeError: index 0 has type 'float' but 'QgsPointXY' is expected

Execution failed after 0.01 seconds

AlisterH avatar Aug 17 '23 03:08 AlisterH

"Lines to Polygon" also produces an error if there is a line that starts and ends at the same point. I note that the "native" (built in) QGIS "lines to polygons" algorithm doesn't error in this case.

AlisterH avatar Aug 17 '23 03:08 AlisterH

I fixed "Lines to Polygon" tool, but I didn't find the problem with "Merge lines in direction". Could you send some example as shapefile or geopackage?

LEOXINGU avatar Apr 29 '24 13:04 LEOXINGU

Ah, yes, it seems it doesn't error with every "line that starts and ends at the same point". But here is an example. example9.zip

AlisterH avatar Apr 30 '24 02:04 AlisterH

I note also that it generally doesn't join lines which would form (or already are) a feature with two vertexes at the same point (except if it is the start and end points). Here is a file to demonstrate. example2.zip

AlisterH avatar Apr 30 '24 02:04 AlisterH