QSDM

QSDM – Species Distribution Modelling for the QGIS Processing Toolbox

My second plugin contribution to QGIS is called QSDM (for QGIS Species Distribution Modelling). Not a too fancy name, but it serves it purpose. I began coding it some time ago in order to run MAXENT models within QGIS and without calling any external program or script. This eases up at least for me a lot of work. The biggest problem with the MAXENT software is that it requires equal extents and shapes of all input environmental vectors. So you have to unify your environmental predictors before running the tool. I am currently in the process of writing my own much faster version of a raster unification script, but until then the excellent scripting solution from Yury aka ssrebelious works just fine. So you can just load in your layers and QSDM will reproject them to latitude-longitude (WGS-84) if necessary, unify them to a common extent if necessary and finally saves them as ESRI .asc file.

Very (!) simple prediction of Lycaena phlaeas occurence in Skane, Sweden. Only Elevation and LandCover were used as Environmental Layers in MAXENT

Very (!) simple prediction of Lycaena phlaeas occurence in Skane, Sweden. Only Elevation and LandCover were used as Environmental Layers in MAXENT

QSDM is designed to show and be able to run only those functions for which you have the necessary dependencies. I know that this might kick out some users, but I am not really fond of helping people installing third-party libraries. Look on the authors homepage or on the net. I am thinking of integrating more models and tools in the future, such as Logistic Regressions, Random Forest Predictions and so on. Depends a lot on my available time, personal interest and willingness.

 

What it can do (05.05.2014):

  • Data Analysis
    • Calculate Niche Overlap Statistics
    • Range Shifts
  • Data Preperation
    • Create Species Richness Grids
    • Data Transformation (simple)
    • Raster Unification, for now using the excellent script from Yury Ryabov
  • Species Distribution Modelling
    • MAXENT (Parameter Preperation)
    • Maximum Entropy Modelling (semi-automatic modelling)
    • Maximum Entropy Modelling (Manual Configuration of parameters)

How-To-Run:

  1. Make sure you have JAVA installed and it is executable. You can try it out by opening a console on your system and enter “java -version”. No error should pop up.
  2. Some of the functions won’t show up in Processing until you have the necessary libraries installed. If you have enabled numpy and scipy you are on a good way. Please don’t ask me how to install libraries on your system.
  3. Download the QSDM Plugin and external dependencies if you haven’t already. For MAXENT for instance you need the maxent.jar file.
  4. Go to the Processing options and enable it. Make sure to set all the correct paths and folders. MAXENT normally requires a output and environmental folders. The plugins workaround is to set these folders in the Processing options.
  5. Try and run some of the functions in the Processing Toolbox.
  6. If unexpected Errors pop up, please try and format your layers to appropriate formats before posting hundreds of data-specific error messages, that are hard to impossible to debug remotely.

Note: This plugin is still experimental, so please don’t expect it to run without issues for all of you.

37 responses to “QSDM”

  1. geomoran says :

    Greetings, where I can download the plugin?

  2. husam El Alqamy says :

    I downloaded the plugin and manually added it to QGIS 2.2.0 Valmeria. When I tried to install it via the plugin manager I was returned with a message ” Invalid Syntax” and the following detailed log

    Couldn’t load plugin QSDM-master due an error when calling its classFactory() method

    Traceback (most recent call last):
    File “C:/PROGRA~1/QGISVA~1/apps/qgis/./python\qgis\utils.py”, line 204, in startPlugin
    plugins[packageName] = package.classFactory(iface)
    File “C:/PROGRA~1/QGISVA~1/apps/qgis/./python/plugins\QSDM-master\__init__.py”, line 34, in classFactory
    return qsdm(iface)
    File “C:/PROGRA~1/QGISVA~1/apps/qgis/./python/plugins\QSDM-master\qsdm_main.py”, line 58, in __init__
    self.provider = qsdm_serviceProvider()
    File “C:/PROGRA~1/QGISVA~1/apps/qgis/./python/plugins\QSDM-master\qsdm_provider.py”, line 48, in __init__
    self.checkRequirements()
    File “C:/PROGRA~1/QGISVA~1/apps/qgis/./python/plugins\QSDM-master\qsdm_provider.py”, line 119, in checkRequirements
    if qsdm_settings.javaPath() == ” or None:
    File “C:/PROGRA~1/QGISVA~1/apps/qgis/./python/plugins\QSDM-master\qsdm_settings.py”, line 59, in javaPath
    if proc == 0:
    UnboundLocalError: local variable ‘proc’ referenced before assignment

    Python version:
    2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]

    QGIS version:
    2.2.0-Valmiera Valmiera, c3a2817

    Python path: [‘C:/PROGRA~1/QGISVA~1/apps/qgis/./python/plugins\\QSDM-master’, ‘C:/Users/alqamy/.qgis2/python/plugins\\processing’, ‘C:/PROGRA~1/QGISVA~1/apps/qgis/./python’, u’C:/Users/alqamy/.qgis2/python’, u’C:/Users/alqamy/.qgis2/python/plugins’, ‘C:/PROGRA~1/QGISVA~1/apps/qgis/./python/plugins’, ‘C:\\PROGRA~1\\QGISVA~1\\bin\\python27.zip’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\Python27\\DLLs’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\Python27\\lib’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\Python27\\lib\\plat-win’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\Python27\\lib\\lib-tk’, ‘C:\\PROGRA~1\\QGISVA~1\\bin’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\Python27’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\Python27\\lib\\site-packages’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\Python27\\lib\\site-packages\\PIL’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\Python27\\lib\\site-packages\\win32’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\Python27\\lib\\site-packages\\win32\\lib’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\Python27\\lib\\site-packages\\Pythonwin’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\Python27\\lib\\site-packages\\Shapely-1.2.18-py2.7-win-amd64.egg’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\Python27\\lib\\site-packages\\six-1.3.0-py2.7.egg’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\Python27\\lib\\site-packages\\xlrd-0.9.2-py2.7.egg’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\Python27\\lib\\site-packages\\xlwt-0.7.5-py2.7.egg’, ‘C:\\PROGRA~1\\QGISVA~1\\apps\\qgis\\python\\plugins\\fTools\\tools’]

    • Curlew says :

      Confirmed this error before. In the next version it will be fixed and a proper errorlog will be generated. The reason is that no working JAVA installation could be detected on your system. Please install the correct version for your architecture.

      Ether you can not run JAVA in a console (or have no right to do so) or JAVA is not in your PATH variable. You can try it out by opening the python console (in the menu python console). Then enter (exactly as written) and press return:

      import os
      os.system(“java -version”)

      You should now see a zero (0) in the console. If not, then java could not be detected.

  3. stephen says :

    I’ve downloaded the QSDM file and placed in qgis/plugins. I can’t seem to find the plugin anywhere on QGIS

    • Curlew says :

      (1) Check if it is in your QGIS plugin manager
      (2) Check if the plugin has been enabled in the Processing Toolbox (options).
      (3) Open Processing and you should see the available tools for your system. Otherwise requirements might not be met.

  4. Firman Hadi (@jalmiburung) says :

    I found the log file in QGIS. The problem was due to no JAVA_HOME variable. I added the JAVA_HOME variable and it solved the problem but another error appeared.
    The error message is ” AttributeError: ‘NoneType’ object has no attribute ‘GetLayer’ “

  5. Manuel Spínola says :

    I ran the Maximum Entropy Modelling module (the second one of the Species Distribution Modelling) but I cannot see any resuts. I didn´t get any error. How can I see the reults.

    Best,

    Manuel

    • Curlew says :

      Which QGIS version are you using? Which OS? Did you specify all the output and configuration folders in the processing options? If you think this is bug, please report it on the bugtracker rather than discussing here. Also attach a sample dataset to reproduce the issue.

  6. caduarte7 says :

    Very nice tool, thanks!! but…

    Installing on Linux 3.15.5, QGIS 2.4.0-Chugiak I get the error:

    this pluigin is broken
    /usr/lib/python2.7/site-packages/PyQt4/Qsci.so: undefined symbol: _ZTI11QsciPrinter

  7. Partha Sarathi Ghose says :

    Hi,

    Thanks for the plugin. It loads well with my version of QGIS. And I have put the requisite info for the MaxEnt analysis. however when I give a run I am receiving the following message –

    ” ‘NoneType’ object has no attribute ‘GetFeatureCount’ See log for more details”

    I guess I am going wrong somewhere, but cannot make out where.

    Could you please help?

    Regards and best wishes,

    Partha

    • Curlew says :

      There must something wrong with your shapefile. Try to save it again as a new file. No csv or database as origin of your vector.
      I sadly cannot help you on remote and QSDM is also still listed as experimental due to this reason.

  8. Viktoria Takacs says :

    Hi ! I had a problem with this plugin, though exactly this I was sesarching for my data analysis. the error message is : “phyton ansvered ” Non-type object has no attribute “settings”. Is it a bug or just something with my settings? How can I proceed further?
    I have Windows 7 and qgis 2,2 version.

    • Curlew says :

      (1) Check that you installed JAVA and MAXENT
      (2) That both are enabled in the Processing settings
      (3) That your files are correct and valid. Try to run Maxent solely in the terminal.
      (4) If it still doesn’t work consider raising a bug-report and I might do something about as soon as I have time ( http://hub.qgis.org/projects/QSDM )
      (5) Remember that this plugin is still in “experimental” state and might be error-prone 🙂

  9. qsdm question says :

    I installed the experimental plugin on QGIS 2.8.1 but I cannot find it. At the plugin manager it shows selected and installed but I cannot find it in any tab. I can see LecoS in the Raster tab but not QSDM. Thank you.

  10. Y HadiprakarsaYoki says :

    Hi,

    After I re-installed the plugin, now I cannot use Unify feature, its always with error message:

    ‘NoneType’ object has no attribute ‘source’ See log for more details

    Any clue how to resolve ?

  11. matt says :

    Hi, i’m only getting one option coming up under species distribution modelling (SVM). I’ve set the the path to maxent.jar file i.e. C:\MaxEnt\maxent.jarand also linked to the java bin folder containing the java i.e. C:\Program Files (x86)\Java\jre1.8.0_73\bin\.

    Any ideas what this could be, thanks in advance

    • Martin Jung says :

      There should be three options if you specified for using Maxent in the species distribution modelling group. SVM (aka Support vector machines) are not implemented, respectively not working yet.
      I just tested it at my office computer and they should show up if the paths to Maxent and java are correctly set.
      Please note that the plugin is still experimental and I have absolutely no time and money to further develop it at the moment (the source code is open though).

  12. JuliusWilliam says :

    Hi, thanks for the plugin.

    Do you have any tutorial on how to use/create the layer into ESRI .asc file using QSDM?

  13. Matthew Watts says :

    “Some of the functions won’t show up in Processing until you have the necessary libraries installed. If you have enabled numpy and scipy you are on a good way. Please don’t ask me how to install libraries on your system”

    Can someone give me some info on the ‘necessary libraries’. Maxent still isnt showing up even tho i have numpy and scipy installed using O Sgeo 4w. thanks

    • Martin Jung says :

      Check that you have the correct path to JAVA and Maxent set in the processing options. However I can not guarantee for anything as the plugin is still experimental.

  14. Colin K Wen says :

    Hi Matt, first many thanks for this plugin. It will help many people include me who is not expert in R or other language and have money for ArcGIS.

    Then the problem I came across is when I run the model in QSDM.
    the QGIS showed “NoneType’ object has no attribute ‘endswith’ See log for more details”

    However, I can not find any deal in log.

    After google this message, it seems like some code is not right in the program.

    Just wonder if anyone has same problem or any heads-up will be great.

    • Martin Jung says :

      Hi Colin,
      Thanks for the kind words.
      Unfortunately I am currently fully occupied with my PhD research and thus unable to spend more time on QSDM development (which is an experimental plugin by the way).

      If you think this is a bug, could you please report it as such in the bug tracking system ( http://hub.qgis.org/projects/qsdm ). And please also include a small data subset to reproduce the bug. I will see what I can do as soon as I have the time to do so.

      Cheers,
      Martin

      • Colin K Wen says :

        Sorry, I meant Martin, not Matt.

        I understand the time and energy consuming of a PhD. Good luck, I believe a talented man like you will get a job sooner after graduated.

        Thanks, and I will go to the website to report it, the reason I left msg here is because I am not a expert on this open-source GIS thingy, I was worried if that was my problem instead of the bug of this plug-in.

        Anyway, I will report what happened to my system on that page.

        Cheers
        Colin

  15. Dino says :

    Hi, I’m using the unify feature to unify a set of 13 layers, it’s taking for ever (by now at least an hour) and QGIS is unresponsive. Is it normal? Can I do it with smaller gruops (6) and have the same result?
    Thanks a lot for your job and kindness.
    Dino

    • Martin Jung says :

      A) don’the know. Depends on your computer speed. B) if that makes sense for you why not? I can not help you with thinking

      • Dino says :

        Everything went better than expected! Your “unify enviromental layers” works like magic! Many thanks.
        Btw, how does “calculate niche overlap stats” works?

  16. Iman says :

    Hi. I installed numpy and scipy but still, only 2 menus are available.
    you can see setting and menus in the below link. what is the problem?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: