CartoLineGen icon indicating copy to clipboard operation
CartoLineGen copied to clipboard

'GetGeometryName'

Open wruwak opened this issue 4 months ago • 3 comments

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

wruwak avatar Aug 20 '25 09:08 wruwak

Same issue here, sometimes I also get

AttributeError: 'NoneType' object has no attribute 'GetLayer'

and also both errors mantioned by Łukasz.

marta-kapolka avatar Aug 22 '25 16:08 marta-kapolka

Same issue here, sometimes I also get

AttributeError: 'NoneType' object has no attribute 'GetLayer'

and also both errors mantioned by Łukasz.

For this error, please check that your layer is not temporary, i.e. memory layer. It should be saved as a file in GPKG or Shapefile.

dtutic avatar Aug 31 '25 08:08 dtutic

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

Thank you, I have tried to track the issue, but so far without success. I am no longer active in this; it would be nice if someone continues development. Here is a theoretical extension of the idea https://www.tandfonline.com/doi/abs/10.1080/23729333.2019.1631535. Maybe there is also an implementation of it, too.

I will continue to check, but I have limited time for this.

dtutic avatar Aug 31 '25 08:08 dtutic