dropping raster layer on spectral view gives user-unfriendly error
Reported by @Agustin Lobo .
Use attached raster to reproduce.
Comments (12)
-
-
- changed status to open
-
reporter Ah sorry, forgot to mention the reporter
@Agustin Lobo , do you have a suggestion for Benjamin? -
reporter - edited description
-
reporter OGR(1): Cannot open C:/Users/Andreas/Downloads/hires_berlin2.tif.()
Traceback (most recent call last):
File "D:\source\QGISPlugIns\enmap-box\enmapbox\externals\qps\speclib\gui\spectrallibrarywidget.py", line 583, in dropEvent
slNew = SpectralLibraryUtils.readFromMimeData(event.mimeData())
File "D:\source\QGISPlugIns\enmap-box\enmapbox\externals\qps\speclib\core\spectrallibrary.py", line 331, in readFromMimeData
sl = SpectralLibrary.readFrom(urls[0])
File "D:\source\QGISPlugIns\enmap-box\enmapbox\externals\qps\speclib\core\spectrallibrary.py", line 1171, in readFrom
return SpectralLibraryUtils.readFromSource(uri, feedback)
File "D:\source\QGISPlugIns\enmap-box\enmapbox\externals\qps\speclib\core\spectrallibrary.py", line 279, in readFromSource
return SpectralLibraryIO.readSpeclibFromUri(uri, feedback=feedback)
File "D:\source\QGISPlugIns\enmap-box\enmapbox\externals\qps\speclib\core\spectrallibraryio.py", line 493, in readSpeclibFromUri
profiles = SpectralLibraryIO.readProfilesFromUri(uri)
File "D:\source\QGISPlugIns\enmap-box\enmapbox\externals\qps\speclib\core\spectrallibraryio.py", line 310, in readProfilesFromUri
importedProfiles = IO.importProfiles(uri, settings, feedback=feedback)
File "D:\source\QGISPlugIns\enmap-box\enmapbox\externals\qps\speclib\io\rastersources.py", line 436, in importProfiles
assert isinstance(rl, QgsRasterLayer) and rl.isValid()
AssertionError -
As far as I understand, drag and drop to the Spectral Library window is meant for spectra only, thus dropping another type of file should just state “Wrong file format. Only spectra can be opened in the Spectral Library window”
-
In addition, the drag enabled icon (“+”) should not appear in case the dragged input cannot be opened anyway.
@Agustin Lobo the spectral library is developed within the QGIS Plugins Support (QPS) repository https://github.com/EnMAP-Box/qgispluginsupport#readme , which has already moved to github. The EnMAP-Box should follow soon. However, the most-recent QPS version and thus update to the spectral library is so far available in the qps_update branch https://bitbucket.org/hu-geomatics/enmap-box/branch/qps_update .
-
@alobo Meanwhile I think a bit different about the standard behaviour. I think is would be much more convenient for drag and drop operations to not show a specific message if the drop cannot be handled in a senseful way.
-
but then there would be no error at all, simply nothing happens, right?
-
Right. Usually User interfaces show a specific icon to indicate if the drop content cannot be handled. However, in case of spectral libraries this would required a too heavy operations just to check if QgsFeatures could be extracted from the drop content
-
ok, with no response at all the user will quickly realize that the given operation is just not contemplated.
Agustin Lobo aloboaleu@gmail.com
-
- changed status to resolved
added scripts/update_qps.sh cleaned README.md resolves
#928→ <<cset c628c6ad1b71>>
- Log in to comment
Can you report the error message as text please?
Which error would you like to see instead?