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

Michael Sumner mdsumner at gmail.com
Tue Jan 24 09:41:22 CET 2017


What is dim(rast)?

Try raster::readAll(rast) - what happens?

On Tue, Jan 24, 2017, 19:26 John Wasige <johnwasige at gmail.com> wrote:

> ​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
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
> University of Tasmania Electronic Communications Policy (December, 2014).
> This email is confidential, and is for the intended recipient only.
> Access, disclosure, copying, distribution, or reliance on any of it by
> anyone outside the intended recipient organisation is prohibited and may be
> a criminal offence. Please delete if obtained in error and email
> confirmation to the sender. The views expressed in this email are not
> necessarily the views of the University of Tasmania, unless clearly
> intended otherwise.
> .
>
-- 
Dr. Michael Sumner
Software and Database Engineer
Australian Antarctic Division
203 Channel Highway
Kingston Tasmania 7050 Australia

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list