[R-sig-Geo] spTransform, gridded

Edzer J. Pebesma e.pebesma at geo.uu.nl
Sat Mar 24 20:25:04 CET 2007


Patrick,

the problem is that if you reproject points on a grid, the result is not 
on a grid anymore, so I think it is correct that spTransform does return 
a SpatialPointsDataFrame rather than a SpatialGridDataFrame. You would 
have to shift points to centers on the new grid. The creator functions 
SpatialPixels() or SpatialPixelsDataFrame have a tolerance, which may be 
used to define to which extent you allow points to be off the points on 
a true grid. I would use that instead of gridded(x)=TRUE.

Note that you do move points, then.
--
Edzer

Patrick Giraudoux wrote:

>Dear Listers,
>
>I am trying to convert a Gtiff object  from a coordinate system to 
>another... I have tried the following:
>
># read the Gtiff file (European Lambert azimuthal equal area)
>fcE<-readGDAL("fclambert.tif")
>proj4string(fcE) # CRS OK
>
># read a shapefile to get the projection system (Lambert II etendu - a 
>French projection Lambert
># conformal conic based on NTF)
>fccoms<-readOGR("U:/Documents and Settings/giraudoux/Mes documents/Map 
>tools/Shapefiles checked prj","FC_communes")
>proj4string(fccoms) # CRS OK
>
># transform
>fcLIIe<-spTransform(fcE, CRS(proj4string(fccoms))) # looks OK
>
># try writing
>writeGDAL(fcLIIe,"fcLIIe.tif")
>Error: gridded(dataset) is not TRUE
>
># try to promote to a grid...
>gridded(fcLIIe)<-TRUE
>suggested tolerance minimum: 0.5Error in points2grid(points, tolerance) 
>: dimension 1 : coordinate intervals are not constant
>
>I  suspect that  pixel centers may have been distorted with the 
>transformation but may naively I wonder if there is a way to turn this 
>problem eg increasing the tolerance...
>
>Any hint appreciated...
>
>Patrick
>
>_______________________________________________
>R-sig-Geo mailing list
>R-sig-Geo at stat.math.ethz.ch
>https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>  
>




More information about the R-sig-Geo mailing list