QGis and Python and R and statistics

Last year I worked on integrating some statistics code with a GIS. After looking at as many open-source cross-platform GIS as I could find, I got stuck with OpenEV. It did the job - just. Its big attraction for me was the built-in python scripting and API - a python script could create new menu items, Gtk dialogs, access map data, create new layers and so on.

My code had to talk to R, a statistics package (www.r-project.org). I did it using Rserve - in this way, R opens a socket on localhost and listens for requests. There were no python bindings for Rserve so I dissected the protocol and wrote my own. Job pretty much done.

Then late last year I upgraded my desktop box to Ubuntu (from RH8). Upgrade time for R, OpenEV, python and so on. Plus the realisation that this code would all have to run on Windows, by non-geeks, in remote villages in Africa.

OpenEV can come as a binary distribution for Linux and Windows, complete with python. But that python didn't have the required files to add extra packages, so I couldn't use that. Plus I wanted to stop using Rserve (which is very clunky), and use Rpy, which links straight into R as a library. But the python in the OpenEV distribution had a thread issue that didn't let Rpy work. Compiling from source looked... messy.

So I decided that what with all those problems, plus the fact that the OpenEV interface is rather non-standard in several aspects of its behaviour, to switch camps and go looking for a new GIS again.

Main candidates were: QGis, Thuban and SAGA. I went for QGis since it was the only one I could get to work reliably. Even the bleeding edge 0.9.0 svn version compiled and I was running python plugins with Rpy straightaway. Woo hoo props to y'all.

If I was a java man I'd take a good look at OpenJUMP, which does some sweet things. But I'm not, so it had to be python, plus I had large chunks of the code done in python already.

I'm now well into the rewrite. The plugin doesn't do an awful lot: basically it registers as a plugin, then when activated it pops up a Qt dialog (made with designer-qt4), when OK'd, this gets some layers from the map and some other parameters from the dialog and runs some statistical methodology for predicting disease prevalence in a defined study area. The output is a grid which is saved as an ESRI raster file and is loaded in as a new map layer.

The plan is to get this all done and to make a demo (with Wink) to show to some WHO people in Geneva by the end of the week. I'm not going, only my .swf file is. Once that's done I'll try and post some more blog entries on technical aspects of writing this thing.

Thanks to Martin D and all on #qgis for help so far and help to come...

Barry

PS: apologies for posting www.doingitwrong.com on #qgis and the ensuing loss of productivity.....

Уроки вождения

Уроки вождения на новых автомобилях, опытный Автоинструктор поможет приобрести навыки в Вождение автомобиля. Обучение вождению
происходит как по городу так и на площадке. Каждый инструктор по вождению опытный Инструктор вождения

Python Rserve

Is it possible for you to share your code for using Rserve functionality through Python? I am more of an economist and not a developer, but do play around with Python and use R quite a bit. Python + Rserve combination would make many things easy. I'd be curious to hear back.

Python/Rserve

I'm looking for a Python/Rserve binding. I've read you've made you're own. Is you intention to share it?

Thanks,
Giovanni

QGIS and Rpy

Hi,

I'm working on a python plugin which also uses Rpy to access R functions, and I'm having trouble getting this to work properly in QGIS. Any suggestions on how to make this work so that I can be "running python plugins with Rpy straightaway" as well? I think the problem is with the RConsole in R, but I'm not sure...

Cheers,

C

QGIS and Rpy

Hi,

I'm working on a python plugin which also uses Rpy to access R functions, and I'm having trouble getting this to work properly in QGIS. Any suggestions on how to make this work so that I can be "running python plugins with Rpy straightaway" as well? I think the problem is with the RConsole in R, but I'm not sure...

Cheers,

C

Rserve with Python

Hi,

I'm working on a python application which needs to talk with Rserve. Could you please let me use your Python bindings for RServe?

Sorry for writing this in the comments section, but I haven't found a contact section or email in the site.

My email: ricardo@mildiez.net

Thanks

rserve with python

I know it could be OT, but I would be very interested in your Rserve/Python porting. I need to make some remote calls to R, and by far this is the only feasable solution to me... I know a bit of Java (Rserve porting exists), but would prefere to do not make an n-tier system, since Im using Python to do my job.
Thanks!
Giovanni

ARGH!

Now I am clicking like mad on that web site!

In the interest of further degrading productivity, Worse than Failure is sort of a geek IT equivalent.