Hello
It would be very helpful for me to resolve the errors. The plugin is best for generalizing contour lines from DTMs. I often get the error
AttributeError: 'NoneType' object has no attribute 'GetGeometryName' or "ValueError: math domain error"
I'm using that file: https://drive.google.com/file/d/14PX_NQ4bMGJUyJqr0kDx_XixtP2DC9kl/view?usp=sharing
(contours interval 0,5m generated from polish open DTM data, with about 31000 objects, plugin says about 831000 vertices)
Same situation starting from smaller file (intervals 2m) from same DTM source (asc file and menu Raster- cut- contours in Qgis).
Łukasz
2025-08-20T21:55:40 WARNING Traceback (most recent call last):
File "C:\Users/arepo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\cartolinegen\cartolinegen.py", line 225, in run
self.generalize(layer)
File "C:\Users/arepo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\cartolinegen\cartolinegen.py", line 327, in generalize
generalize.Generalize(scale,area,alg_type,inFile,outFile)
File "C:\Users/arepo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\cartolinegen\generalize.py", line 916, in Generalize
gen,out_geom = Decide(geom,closed,1,out_geom,alg_type,1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users/arepo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\cartolinegen\generalize.py", line 717, in Decide
flag,smooth = Smooth_Line(simpl) #flag == 0 means that geometry should be deleted from output
^^^^^^^^^^^^^^^^^^
File "C:\Users/arepo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\cartolinegen\generalize.py", line 672, in Smooth_Line
ps,pq = Smooth(points[i-1], points[i], points[i+1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users/arepo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\cartolinegen\generalize.py", line 473, in Smooth
z = math.sqrt(aa+B)
^^^^^^^^^^^^^^^
ValueError: math domain error
Hello
It would be very helpful for me to resolve the errors. The plugin is best for generalizing contour lines from DTMs. I often get the error
AttributeError: 'NoneType' object has no attribute 'GetGeometryName' or "ValueError: math domain error"
I'm using that file: https://drive.google.com/file/d/14PX_NQ4bMGJUyJqr0kDx_XixtP2DC9kl/view?usp=sharing
(contours interval 0,5m generated from polish open DTM data, with about 31000 objects, plugin says about 831000 vertices)
Same situation starting from smaller file (intervals 2m) from same DTM source (asc file and menu Raster- cut- contours in Qgis).
Łukasz
2025-08-20T21:55:40 WARNING Traceback (most recent call last):
File "C:\Users/arepo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\cartolinegen\cartolinegen.py", line 225, in run
self.generalize(layer)
File "C:\Users/arepo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\cartolinegen\cartolinegen.py", line 327, in generalize
generalize.Generalize(scale,area,alg_type,inFile,outFile)
File "C:\Users/arepo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\cartolinegen\generalize.py", line 916, in Generalize
gen,out_geom = Decide(geom,closed,1,out_geom,alg_type,1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users/arepo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\cartolinegen\generalize.py", line 717, in Decide
flag,smooth = Smooth_Line(simpl) #flag == 0 means that geometry should be deleted from output
^^^^^^^^^^^^^^^^^^
File "C:\Users/arepo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\cartolinegen\generalize.py", line 672, in Smooth_Line
ps,pq = Smooth(points[i-1], points[i], points[i+1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users/arepo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\cartolinegen\generalize.py", line 473, in Smooth
z = math.sqrt(aa+B)
^^^^^^^^^^^^^^^
ValueError: math domain error