[R-sig-Geo] Bug in rasterToPoints() ?

Agustin Lobo alobolistas at gmail.com
Wed Jul 14 20:46:25 CEST 2010


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



More information about the R-sig-Geo mailing list