LEOXINGU / lftools

Tools for cartographic production, surveying, digital image processing and spatial analysis.
MIT License
50 stars 7 forks source link

Merge lines in direction error #9

Open AlisterH opened 1 year ago

AlisterH commented 1 year ago

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 commented 1 year ago

"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.

LEOXINGU commented 4 months ago

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?

AlisterH commented 4 months ago

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 commented 4 months ago

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