Skip to content

Bug in rasterToPoints() ?

5 messages · Jacob van Etten, Agustin Lobo, Robert J. Hijmans

#
Hi!
I'm trying:
Error in projection(x, asText = FALSE) : cannot use this x of class NULL
Calls: rasterToPoints ... SpatialPoints -> new -> initialize ->
initialize -> projection
[1] "+proj=longlat +ellps=WGS84"
[1] "RasterLayer"
attr(,"package")
[1] "raster"
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:
Cells:  13967442
NAs  :  0


Min.       0.00
1st Qu.    0.00
Median     0.00
Mean      48.82
3rd Qu.    0.00
Max.    4999.00
[1] "RasterLayer"
attr(,"package")
[1] "raster"
[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
5 days later
#
While 
test <-rasterToPoints(Br025,fun=function(x){x>0},asSpatialPoints=T)
does not work, the following works:
[1] "SpatialPointsDataFrame"
attr(,"package")
[1] "sp"
[1] "+proj=longlat +ellps=WGS84"
Object of class SpatialPointsDataFrame
Coordinates:
    min   max
x -8.75 28.00
y 41.50 59.75
Is projected: FALSE 
proj4string : [+proj=longlat +ellps=WGS84]
Number of points: 2576
Data attributes:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   0.50    7.00   33.75  178.00  152.10 3638.00 

although the value of slot "Is projected:" indicates some problem.

Agus
#
Thanks Agus, I fixed this in raster version 1.3-0. Robert
On Mon, Jul 19, 2010 at 11:46 PM, Agustin Lobo <alobolistas at gmail.com> wrote:
#
Thanks!
Agus

2010/7/20 Robert J. Hijmans [via R-sig-geo]
<ml-node+5317401-2030277865-197315 at n2.nabble.com>: