[R-sig-Geo] Converting raster to a matrix

John Wasige johnwasige at gmail.com
Tue Jan 24 09:23:38 CET 2017


​Dear all,
Greetings!

I want to convert a big raster (see attached) a matrix, however, I get the
error below from the script. Anybody with an Idea on what is going wrong in
my script?

###Errors at the following point in the script​

> mat <- as.matrix(rast)Error in .local(x, ...) : 'x' has no values

#####script



​library(raster)
library(rgdal)

setwd('D:/Mobile_testdata')
image <- raster('D:/Mobile_testdata/SOSug_mean2qgis.tif')

rast <-  raster(image)
mat <- as.matrix(rast)

Thanks for your help

Rgds John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20170124/291f6abc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SOSug_mean2qgis.tif.aux.xml
Type: text/xml
Size: 1247 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20170124/291f6abc/attachment.xml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SOSug_mean2qgis.tfw
Type: application/octet-stream
Size: 79 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20170124/291f6abc/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SOSug_mean2qgis.tif
Type: image/tiff
Size: 4010 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20170124/291f6abc/attachment.tif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SOSug_mean2qgis.tif.vat.cpg
Type: application/octet-stream
Size: 5 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20170124/291f6abc/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SOSug_mean2qgis.tif.vat.dbf
Type: application/octet-stream
Size: 5498 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20170124/291f6abc/attachment-0002.obj>


More information about the R-sig-Geo mailing list