Home-range analyses in QGIS using R through Python

Anne Ghisla's Google Summer of Code project, mentored by Timothy H. Keitt

State of the art

Version 1.0 is available on Faunalia QGIS plugin repo (see Download section).

The plugin works well with RPy, with which it has been first written down. The upgrade of code to rpy2 will come soon. Under Debian unstable, both R 2.8.0 and a suitable rpy are available and the plugin already works. For Windows, I have to adapt the code to load rpy2 module instead of rpy, where necessary.

Testing is welcome! Bug reporting and wishlist is provided by Faunalia: https://www.faunalia.it/animove/trac/

Documentation is provided inside the plugin folder. A short tutorial is contained into doc subfolder. You can find suitable data on AniMove page.

Download

The code is available on Faunalia QGIS plugin repository:

http://www.faunalia.it/qgis/plugins.xml for QGIS <=0.11

http://faunalia.it/qgis/1.x/plugins.xml for QGIS 1.0

Just add the correct URL to your sources list in Plugin Installer. The plugin is named HomeRange_plugin.

A SVN repository contains trunk and branches of the development. Contributors: please contact a.ghisla@studenti.uninsubria.it to ask for write access.

svn://home.prea.net/svn/HomeRange_plugin/

Installation requirements and tested platforms

Platform

QGIS

Python

R

RPy

R packages

generic

>=0.9

2.5

>=2.6.2

1.0.1 for R <2.7.0, RPy2 for R >=2.7.1 <!>

adehabitat, rgdal, all their dependencies {*}

Ubuntu 8.04 64bit

compiled 0.10

2.5

2.6.2

python2.5-rpy (1.0.1-1)

adehabitat 1.7.1

Debian Etch/Lenny

0.11 and 1.0 preview

2.5

2.7.1 and 2.8.0

python-rpy (the most recent)

adehabitat 1.7.2

Windows "testing"

0.10, 0.11 and 1.0 preview

2.5

2.7.1 and 2.8.0

1.0.3-R-2.7.0-win32-py2.5 / rpy2 2.0.0 a2 py2.5

adehabitat 1.7.2

Windows "stable"

0.9 and 0.10

2.5

2.6.2

RPy for <2.7.0

adehabitat 1.7.1

{*} Install them with the R command install.packages("<name of the package>", dep = TRUE)

<!> R 2.7.0 can't load adehabitat, because its latest version (1.7.2) requires 2.7.1. So R 2.7.0 is not suitable. For R 2.7.1 or higher, be careful to use the correct Rpy.

Timeline

Week

Planned

Done?

Report

1 - from 26.5

polish R code, refactor, test

(./)

none

2 - from 2.6

set up repo and work on R code

(./)

link

3 - from 9.6

(prepare Java exam)

(./)

link

4 - from 16.6

set up the GUI

(./)

link

5 - from 23.6

work on GUI

(./)

link

6 - from 30.6

connected to R and QGIS Legend

(./)

link

7 - from 7.7

MCP analysis complete

(./)

link

8 - from 14.7

refactorisation

(./)

link

9 - from 21.7

merged python files into plugin.py, deep interface refactoring

(./)

link

10 - from 28.7

beta version, further functionality, testing

(./)

link

11 - from 4.8

improvements

(./)

link

12 - from 11.8

documentation

(./)

link

13 - from 18.8

(holiday in Belgium)

[link]

14 - from 25.8

[link]

Into the code: List of available layers

6th week report is about combobox population with all available point layers. It is possible to get the layer list from MapCanvas, i.e. the part of the main window where checked layers are shown. If no layer is checked, nothing is displayed in MapCanvas, and the retrieved list is empty.

I solved this retrieving the list of loaded layers from an instance of QgsMapLayerRegistry. This list contains all layers shown in Legend, both checked and unchecked. This way, the point layer named "samplepoints" is present in the box even if absent from the Canvas.

I guess it's a better implementation, because there is no need of displaying data when using my plugin. If the layers I'm working on are large, checking them in order to add them to the list of available layers could be a long and unuseful operation.

Here is a screenshot:

GSoC2008Rbinding (last edited 2008-12-01 16:05:48 by AnneGhisla)