Strange. It looks as if the projection slot holds something that is not of class CRS.

Could you make a reproducible example (a small raster with the same projection)?

Using show (= just the name of the raster) gives more useful information about the raster than summary().

Jacob.


--- On Wed, 14/7/10, Agustin Lobo <alobolistas@gmail.com> wrote:

From: Agustin Lobo <alobolistas@gmail.com>
Subject: [R-sig-Geo] Bug in rasterToPoints() ?
To: "r-sig-geo" <r-sig-geo@stat.math.ethz.ch>
Date: Wednesday, 14 July, 2010, 20:46

Hi!
I'm trying:
> Br025SpPoints <- rasterToPoints(Br025,fun=function(x){x>0},asSpatialPoints=T)
Error in projection(x, asText = FALSE) : cannot use this x of class NULL
Calls: rasterToPoints ... SpatialPoints -> new -> initialize ->
initialize -> projection

> projection(Br025)
[1] "+proj=longlat +ellps=WGS84"

> class(Br025)
[1] "RasterLayer"
attr(,"package")
[1] "raster"

> summary(Br025)
Cells:  18000
NAs  :  0

Min.       0.00
1st Qu.    0.00
Median     0.00
Mean      25.47
3rd Qu.    0.00
Max.    3638.00

The same works (albeit extremely slowly because of its size) for a
projected raster:
> summary(Br)
Cells:  13967442
NAs  :  0


Min.       0.00
1st Qu.    0.00
Median     0.00
Mean      48.82
3rd Qu.    0.00
Max.    4999.00

> class(Br)
[1] "RasterLayer"
attr(,"package")
[1] "raster"

> projection(Br)
[1] "+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000
+ellps=GRS80 +units=m +no_defs"

Maybe longlat is not contemplated by rasterToPoints() ?

Thanks!

Agus

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



      
	[[alternative HTML version deleted]]

