[Qgis-developer] QGIS - SEXTANTE - R

Matteo Mattiuzzi matteo at mattiuzzi.com
Fri Feb 22 03:12:59 PST 2013


Dear list,

I have now tested the possibilities to integrate R Processing in Q-GIS. I
think it closes the huge gap in R of interactive visualization and also
gives the possibility to use R-functionality to non-R people!

I saw that a raster/vector file is loaded through rgdal and there is no
possibility to do it in the own way, such as the almost standard 'raster'
package that handles also out of RAM data!
In order to maintain the flexibility of R I think that arguments should be
passed as they are (path+file) and everybody would be free to benefit from
the entire R repository of functions.
Thanks Matteo

here an example for extracting and plotting pixels based on vector, point
or polygon shp file:

##[MyScr]=group
##vector=vector
##raster=raster
library(raster)

s <- shapefile(vector) % high level function from raster package, the
argument should be only the file path+ name
r <- brick(raster) % high level function from raster package, the argument
should be only the file path+ name

v <- extract(r,s)
##showplots
for(u in seq_along(v))
{
    val <- v[[u]]
    if(u>1) X11()


plot(x=1:ncol(val),ylim=c(min(val),max(val)),type="n",main=paste("Extraction
line",u),xlab="Band",ylab="Spectral")

    for(i in 1:nrow(val))
    {
       lines(val[i,],col=i)
    }
}

############################
LINUX Ubuntu 12.10
QGIS version1.9.0-MasterQGIS code revision2a2465eCompiled against
Qt4.8.1Running
against Qt4.8.1Compiled against GDAL/OGR1.9.2Running against GDAL/OGR1.9.2GEOS
Version3.3.3PostgreSQL Client Version9.1.8SpatiaLite Version3.1.0-RC2QWT
Version5.2.2PROJ.4 Version480QScintilla2 VersionThis copy of QGIS writes
debugging output.

R version 2.15.2 (2012-10-26) -- "Trick or Treat"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130222/0e38a098/attachment.html>


More information about the Qgis-developer mailing list