dropping raster layer on spectral view gives user-unfriendly error

Issue #928 resolved
Andreas Janz created an issue

Reported by @Agustin Lobo .
Use attached raster to reproduce.

Comments (12)

  1. Benjamin Jakimow

    Can you report the error message as text please?
    Which error would you like to see instead?

  2. Andreas Janz reporter

    Ah sorry, forgot to mention the reporter 🙂
    @Agustin Lobo , do you have a suggestion for Benjamin?

  3. Andreas Janz 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

  4. Agustin Lobo

    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”

  5. Benjamin Jakimow

    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 .

  6. Benjamin Jakimow

    @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.

  7. Benjamin Jakimow

    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

  8. Agustin Lobo

    ok, with no response at all the user will quickly realize that the given operation is just not contemplated.

    Agustin Lobo aloboaleu@gmail.com

  9. Log in to comment