coolzhao / Geo-SAM

A QGIS plugin tool using Segment Anything Model (SAM) to accelerate segmenting or delineating landforms in geospatial raster images.
MIT License
199 stars 26 forks source link

QGIS LTR 3.28 #9

Closed cycle4 closed 10 months ago

cycle4 commented 11 months ago

Hello ! Thank you for your work with this plugin I wanted to raise the issue about the incompatibility of the image encoder with the current long term release of QGIS (3.28 Bial.). Is it something you are going to fix ? The error message that QGIS returns is : "qgis has no attribute DistanceUnit" in sam_processing_algorithm.py line 315 Moreover, the installation on a Linux machine (Ubuntu 22.04) seems to fail. The moment I tick the box to activate the plugin (after having done all the steps), QGIS crashes. Is anyone working on Linux have the same issue ?

Fanchengyan commented 11 months ago

Hi @cycle4, this error may be not due to version issue, but an issue with installation of QGIS. Did you install QGIS in a conda environment? If so, please uninstall QGIS, exit the conda environment (conda deactivate), and reinstall QGIS follow the doc: https://www.qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu. If there are no issues with QGIS, this error should not occur.

fvcamargo commented 11 months ago

I have the same error as above, I am using MacOS and Qgis 3.28.9 long term release What can I do?

Traceback (most recent call last): File "/Users/veigadf/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/Geo-SAM/tools/sam_processing_algorithm.py", line 315, in processAlgorithm if rlayer.crs().mapUnits() == Qgis.DistanceUnit.Degrees: AttributeError: type object 'Qgis' has no attribute 'DistanceUnit'

Fanchengyan commented 11 months ago

Hi @cycle4 @fvcamargo , I'm sorry, after testing, it turns out that this problem is indeed a version issue with QGIS. We developed according to the latest development documentation, and older versions of QGIS were not tested. Please install version 3.30 or higher of QGIS. As for version 3.28, we will consider whether it needs to be fixed in the future.

cycle4 commented 11 months ago

Ok thanks for the answer ! It works fine on 3.30, but I mostly use the LTR since it is more stable and I prefer not to change the version every week I'll keep an eye on the future updates thanks again for your work !

fvcamargo commented 11 months ago

Great, it worked in MacOS Qgis 3.32!

Thanks for developing this awesome plugin. I think it is better to use with SAM compared to Geometric_Atributes

coolzhao commented 11 months ago

Hi @fvcamargo and @cycle4, thanks for your suggestions. While developing the encoding tool, I was aware of the issue since the QGIS.DistanceUnit class was introduced after QGIS 3.30. It's better to be compatible with the more stable LTR release, so I have adjusted the code and tested it on QGIS 3.28 LTR. Please let me know if the current release (v1.1.1) solves your problems with QGIS 3.28 LTR.

cycle4 commented 11 months ago

Yes it works fine now on QGIS 3.28 LTR I just tested it thanks a lot !