Hi!

Are you sure that the *spTransform *method can be applied to a SpatialGrid
object? I think it only works for SpatialPoints, SpatialLines and
SpatialPolygons.
If you are working with rasters, perhaps you should use the function
*projectRaster
*from the package raster.

I hope it helps...

Isa.

2010/7/1 Agustin Lobo <alobolistas@gmail.com>

> Hi!
>
> I use spTransform to reproject:
>
> > class(eugrd025)
> [1] "SpatialGrid"
> attr(,"package")
> [1] "sp"
>
> > projection(eugrd025)
> [1] "+proj=longlat +ellps=WGS84"
>
> > eugrd025EFDC <- spTransform(eugrd025,
> CRSobj=CRS(projection(eugrd025EFDC_SPDF)))
>
> > projection(eugrd025EFDC)
> [1] "+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000
> +ellps=GRS80 +units=m +no_defs"
>
> This is good, but:
> > class(eugrd025EFDC)
> [1] "SpatialPoints"
> attr(,"package")
> [1] "sp"
>
> Why is the class changed to SpatialPoints? I need a grid object for
> > eugrd025EFDCr <- raster(eugrd025EFDC)
> > Br025 <- resample(Br,eugrd025EFDCr)
>
> don't I?
>
> I also have the problem that the CRS of eugrd025EFDCr is not conserved:
> > projection(Br)
> [1] "+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000
> +ellps=GRS80 +units=m +no_defs"
>
> > projection(eugrd025EFDC)
> [1] "+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000
> +ellps=GRS80 +units=m +no_defs"
>
> > projection(eugrd025EFDCr)
> [1] "NA"
>
> which I fix with
> > projection(eugrd025EFDCr) <- CRS(projection(eugrd025EFDC))
>
> and repeat
> > Br025 <- resample(Br,eugrd025EFDCr)
>
> Anyway, I get a much coarser raster than I want:
> > dim(Br025)
> [1] 10 10  1
>
> because
> > dim(eugrd025EFDCr)
> [1] 10 10  1
>
> While it should be 180x100:
>
> > summary(eugrd025EFDC)
> Object of class SpatialPoints
> Coordinates:
>       min     max
> s1 2498538 6561151
> s2 1327858 4313263
> Is projected: TRUE
> proj4string :
> [+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80
> +units=m +no_defs]
> Number of points: 18000
> > dim(Br025)
> [1] 10 10  1
>
> > summary(eugrd025)
> Object of class SpatialGrid
> Coordinates:
>              min    max
> coords.x1 -10.125 34.875
> coords.x2  34.875 59.875
> Is projected: FALSE
> proj4string : [+proj=longlat +ellps=WGS84]
> Number of points: 2
> Grid attributes:
>  cellcentre.offset cellsize cells.dim
> 1               -10     0.25       180
> 2                35     0.25       100
>
> Is eugrd025EFDCr wrong because class(eugrd025EFDC) has been changed
> from SpatialGrid to SpatialPoints?
>
> Agus
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



-- 
Isabelle Boulangeat, PhD student
Ecosystem dynamics and plant traits

Bureau 203, +33 (0) 476 635 733

Laboratoire d'écologie Alpine (LECA)
Grenoble, France
lab' s website : http://www-leca.ujf-grenoble.fr/
my website : http://j.boulangeat.free.fr/

	[[alternative HTML version deleted]]

