semiautomaticgit / SemiAutomaticClassificationPlugin

https://fromgistors.blogspot.com/p/semi-automatic-classification-plugin.html
Other
136 stars 50 forks source link

Shapefile polygons for accuracy #77

Closed fpirotti closed 3 years ago

fpirotti commented 4 years ago

Hello Luca, again thanks for this great plugin. If I try to use a shapefile for calculating accuracy I get the error reported at the end . It is simply replicable by saving any areas used for ROIs as a shapefile and using it for reference layer in accuracy - everything works if I use the ROI layer directly. Things work again if I import the shapefile as spectral signature in the SCP format. From the error it looks like something related to reading the EPSG code for a reprojection process, but all files used are in the same CRS. immagine

An error has occurred while executing Python code:

UnboundLocalError: local variable 'reml' referenced before assignment Traceback (most recent call last): File "C:/Users/FrancescoAdmin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\accuracy.py", line 124, in errorMatrix cfg.utls.repojectShapefile(l.source(), int(vEPSG), reprjShapefile, int(rEPSG)) ValueError: invalid literal for int() with base 10: 'No'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/Users/FrancescoAdmin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\accuracy.py", line 48, in calculateErrorMatrix self.errorMatrix(self.clssfctnNm, cfg.referenceLayer) File "C:/Users/FrancescoAdmin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\accuracy.py", line 127, in errorMatrix cfg.utls.removeLayerByLayer(reml) UnboundLocalError: local variable 'reml' referenced before assignment

Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] QGIS version: 3.8.2-Zanzibar Zanzibar, 4470baa1a3

Python Path: C:/PROGRA~1/QGIS3~1.8/apps/qgis/./python C:/Users/FrancescoAdmin/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:/Users/FrancescoAdmin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins C:/PROGRA~1/QGIS3~1.8/apps/qgis/./python/plugins C:\Program Files\QGIS 3.8\bin\python37.zip C:\PROGRA~1\QGIS3~1.8\apps\Python37\DLLs C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib C:\Program Files\QGIS 3.8\bin C:\PROGRA~1\QGIS3~1.8\apps\Python37 C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\win32 C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\win32\lib C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\Pythonwin C:/Users/FrancescoAdmin/AppData/Roaming/QGIS/QGIS3\profiles\default/python

semiautomaticgit commented 4 years ago

Hello Francesco,

it seems a QGIS issue related to the export of ROI (that is loaded in QGIS as a temporary layer) as shapefile. The EPSG code of the coordinate reference system is not correctly saved during the export process. I'll try to find a workaround, but for the moment you can use the ROIs directly.

semiautomaticgit commented 3 years ago

I'm closing this because of the new version 7. If you still get the same issue, please reopen it