Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no attribute 'collections' when using Iso Area As Polygons From Point or Layer #71

Closed
marteinnm opened this issue Jan 31, 2025 · 10 comments

Comments

@marteinnm
Copy link

Trying to run the Iso Area As Polygons and neither tool works for point or layer.
Using the same input I can get Iso Area As interpolation to work.

Network layer is in the same CRS as the project and the point layer.

Before the error the process

QNEAT3\algs\IsoAreaAsPolygonsFromPoint.py", line 249, in processAlgorithm
polygon_featurelist = net.calcIsoPolygons(max_dist, interval, output_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Qneat3Framework.py", line 493, in calcIsoPolygons
for collection in contours.collections:
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'QuadContourSet' object has no attribute 'collections'
QGIS version: 3.34.15-Prizren
QGIS code revision: 386f2583
Qt version: 5.15.13
Python version: 3.12.8
GDAL version: 3.10.1
GEOS version: 3.13.0-CAPI-1.19.0
PROJ version: Rel. 9.5.1, December 1st, 2024
PDAL version: 2.8.3 (git-version: 56e405)
sys.version
'3.12.8 (main, Dec 20 2024, 15:21:15) [MSC v.1938 64 bit (AMD64)]'

Before the process the following is shown in the log:
[QNEAT3Algorithm] Calculating Iso-Pointcloud...
[QNEAT3Network][calcIsoPoints] Processing Point 0
[QNEAT3Network][calcIsoPoints] Added 10000 Nodes to iso pointcloud...
[QNEAT3Network][calcIsoPoints] Added 20000 Nodes to iso pointcloud...
[QNEAT3Network][calcIsoPoints] Added 30000 Nodes to iso pointcloud...
[QNEAT3Network][calcIsoPoints] Added 40000 Nodes to iso pointcloud...
[QNEAT3Network][calcIsoPoints] Added 50000 Nodes to iso pointcloud...
[QNEAT3Network][calcIsoPoints] Added 60000 Nodes to iso pointcloud...
[QNEAT3Network][calcIsoPoints] Added 70000 Nodes to iso pointcloud...
[QNEAT3Network][calcIsoPoints] Added 80000 Nodes to iso pointcloud...
[QNEAT3Algorithm] Calculating Iso-Interpolation-Raster using QGIS TIN-Interpolator...
[QNEAT3Algorithm] Calculating Iso-Polygons using numpy and matplotlib...
[QNEAT3Network][calcIsoPolygons] calculating 500.0-level contours

Then right after I get the error as shown above with a filepath.

Could this be a problem with matplotlib versioning?

I read the following: MatplotlibDeprecationWarning: The collections attribute was deprecated in Matplotlib 3.8 and will be removed two minor releases later

Collections attribute deprecation in version > 3.8

@root676
Copy link
Owner

root676 commented Jan 31, 2025

Thank you for reporting this issue. The change in the Matplotlib API could in deed be the cause of this issue.

@marteinnm
Copy link
Author

Thank you for the swift response Clemens. Do you think this is something that will be fixed or is the plugin dormant?

@root676
Copy link
Owner

root676 commented Jan 31, 2025

I guess it has to be fixed. Unfortunately I am very busy at the moment, but due to the fact that it is breaking the plugin, I would like to look into the issue later. Thank you for the link to the deprecation info.

@root676
Copy link
Owner

root676 commented Feb 3, 2025

Fixed with this commit. @marteinnm can you test the fix with the current version of the repo? If it works for you too, I will publish it in the qgis plugin manager.

@marteinnm
Copy link
Author

marteinnm commented Feb 4, 2025

Bear with me, I'm not very proficient in the Github world. I tried downloading the ZIP as shown in the figure. When I install the plugin from the ZIP I get the following error:

Image

Couldn't load plugin 'QNEAT3-master' due to an error when calling its classFactory() method

ModuleNotFoundError: No module named 'QNEAT3'
Traceback (most recent call last):
File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 423, in startPlugin
plugins[packageName] = package.classFactory(iface)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users/marteinnm/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QNEAT3-master_init
.py", line 22, in classFactory
from .Qneat3Plugin import Qneat3Plugin
File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 892, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users/marteinnm/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QNEAT3-master\Qneat3Plugin.py", line 21, in
from QNEAT3.Qneat3Provider import Qneat3Provider
File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 892, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'QNEAT3'

Python version: 3.12.8 (main, Dec 20 2024, 15:21:15) [MSC v.1938 64 bit (AMD64)]
QGIS version: 3.34.15-Prizren Prizren, 386f2583

Python Path:
C:/OSGeo4W/apps/qgis-ltr/./python
C:/Users/marteinnm/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/marteinnm/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/OSGeo4W/apps/qgis-ltr/./python/plugins
C:\OSGeo4W\apps\grass\grass84\etc\python
C:\WINDOWS\system32
C:\OSGeo4W\bin\python312.zip
C:\OSGeo4W\apps\Python312\DLLs
C:\OSGeo4W\apps\Python312\Lib
C:\OSGeo4W\bin
C:\OSGeo4W\apps\Python312
C:\OSGeo4W\apps\Python312\Lib\site-packages
C:\OSGeo4W\apps\Python312\Lib\site-packages\win32
C:\OSGeo4W\apps\Python312\Lib\site-packages\win32\lib
C:\OSGeo4W\apps\Python312\Lib\site-packages\Pythonwin
C:/Users/marteinnm/AppData/Roaming/QGIS/QGIS3\profiles\default/python

@marteinnm marteinnm reopened this Feb 4, 2025
@marteinnm
Copy link
Author

Ok sorry for the spam and closing and reopining, that was a mistake. After copy-pasting the QNEAT3Framework.py code into my local script and restarting Qgis the plugin works fine again. Thanks for the swift response! I'll let you close the issue.

@amacart13
Copy link

Hi, I have the same problem but I'm not that good at solving problems like this and I didn't quite understand how you solved it. Can you please tell me in more detail what to do?

@marteinnm
Copy link
Author

I am definitely no expert in this realm so be advised that this is at your own risk. What I did was navigating to the AppsData folder (which is a hidden folder) and finding the script that root676 changed there (Qneat3Framework.py). You can open it with a text editor such as word pad or notepad ++ f.x. Don't open it with microsoft word or similar. I then copy - pasted the whole updated script from github into the Qneat3Framework.py script, overwriting everything that was previously there. You can just select all and then paste to do that ;). Then I saved the file and closed it, and restarted QGIS. This solved my issue.
You should find the folder at C:\Users\YOURUSERNAME\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\QNEAT3
Just change YOURUSERNAME into your username.
I'm fairly sure that the plugin will be updated soon and you won't have to go through this, just update the app in QGIS. But if it's time sensitive as it was in my case, this might work for you. Good luck!

@root676
Copy link
Owner

root676 commented Feb 5, 2025

@marteinnm thanks for testing and your helping explanations! @amacart13 I just uploaded the plugin to the QGIS plugin repository awaiting approval. An update should show up in your qgis plugin manager as soon as the team at QGIS has approved the version (1-2 Days, maybe earlier).

@root676 root676 closed this as completed Feb 5, 2025
@amacart13
Copy link

@root676 Thanks, everything is working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants