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.
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:
- 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.
- 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.
- Download the QSDM Plugin and external dependencies if you haven’t already. For MAXENT for instance you need the maxent.jar file.
- 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.
- Try and run some of the functions in the Processing Toolbox.
- 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.
Greetings, where I can download the plugin?
Through the QGIS plugin management tool (in the menu) or alternatively here (http://plugins.qgis.org/plugins/QSDM/), but then you need to unzip it in your QGIS profile folder yourself (./qgis2/plugins/python/)
thanks but does not work, just run the master version?
if it doesn’t work this has something to do with your QGIS settings and not with the plugin. Likely with the Internet-connection. Also notice that the Plugin is checked as experimental, so you might want to enable those plugins in the options.
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’]
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.
I’ve downloaded the QSDM file and placed in qgis/plugins. I can’t seem to find the plugin anywhere on QGIS
(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.
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’ “
You are using a point shapefile? Anything else might not work yet on this state of development.
If you think this might be a bug, please raise a bug-report, describe your problem and attach a subset of your data. http://hub.qgis.org/projects/qsdm
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
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.
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
Hi. First: If you think this is a bug: please use the bugtracker rather than commenting here.
Regarding your problem: A quick googling should inform you that this is a general qgis bug and is caused by a regression of an outdated pyqt4 package (https://hub.qgis.org/issues/10836).
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
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.
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.
(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 đŸ™‚
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.
Look in the Processing options if it shows up there. The plugin doesn’t have its own plugin menu
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 ?
No clue unless you raise a bug-report and attach a subset of your data so that I can reproduce the error. –> http://hub.qgis.org/projects/QSDM
Remote-Diagnosis is almost impossible
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
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).
Hi, thanks for the plugin.
Do you have any tutorial on how to use/create the layer into ESRI .asc file using QSDM?
No, sadly I don’t have the time to write such a tutorial. You can export raster layers within QGIS into different formats (including .asc). Google for gdal_translate
thanks for the reply
“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
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.
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.
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
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
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
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
Everything went better than expected! Your “unify enviromental layers” works like magic! Many thanks.
Btw, how does “calculate niche overlap stats” works?
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?
No idea and no time to bugfix. Check your python error console, maybe this will give a hint. Also raise a bug report here instead of posting a comment. https://github.com/Martin-Jung/QSDM/ Generally this plugin is EXPERIMENTAL and might not work for everyone
Hello,
I am wanting to create an SDM/CEM using your QSDM tool.
I believe the range shift tool, will be the correct one to use.
however i cannot find anywhere online on how to use this e.g. a tutorial.
Would you be able to help me with this?
Many Thanks,
Hi Katherine,
I haven’t developed the QSDM tool since quite a while and I am not even sure it is working as intended anymore. I think you would be better off finding an alternative way of doing it.
M.