[R-sig-Geo] spTransform, gridded
Roger.Bivand at nhh.no
Sat Mar 24 20:27:04 CET 2007
On Sat, 24 Mar 2007, Patrick Giraudoux wrote:
> Dear Listers,
> I am trying to convert a Gtiff object from a coordinate system to
> another... I have tried the following:
This is warping, so in general the output will not be a regular grid. If
you need a grid, try interpolating to an empty grid in the target
projection (IDW in gstat ought to be OK if the resolutions are similar,
with a small number of neighbours). My guess is that fcLIIe is a
SpatialPoints* object, not on a regular grid.
You could use gdalwarp externally to do this, if you prefer.
> # read the Gtiff file (European Lambert azimuthal equal area)
> 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
> Error: gridded(dataset) is not TRUE
> # try to promote to a grid...
> 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...
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo