Ahhh...a missing "+". Probably caused by a lack of caffeine. :) Thanks also for suggesting the raster package... I will look into this.
Julian On Wed, Oct 20, 2010 at 6:56 AM, Roger Bivand <roger.biv...@nhh.no> wrote: > On Wed, 20 Oct 2010, Julian Burgos wrote: > > Dear list, >> I have a problem trying to change the projection of a >> SpatialPixelsDataFrame, from UTM to lat/long. My object has the following >> characteristics: >> >> summary(mb) >>> >> Object of class SpatialPixelsDataFrame >> Coordinates: >> min max >> X -14.17196 -13.76879 >> Y 63.75071 63.96791 >> Is projected: TRUE >> proj4string : [+proj=utm +zone=28 +datum=WGS84] >> Number of points: 5669540 >> Grid attributes: >> cellcentre.offset cellsize cells.dim >> X -14.17189 1.347473e-04 2992 >> Y 63.75074 5.944386e-05 3654 >> Data attributes: >> Min. 1st Qu. Median Mean 3rd Qu. Max. >> 108.5 230.3 256.9 283.0 287.9 987.6 >> >> when using the spTransform I get the following error message: >> >> mb=spTransform(mb,CRS("proj=longlat +datum=WGS84")) >>> >> Error in spTransform(mb, CRS("proj=longlat +datum=WGS84")) : >> error in evaluating the argument 'CRSobj' in selecting a method for >> function 'spTransform' >> > > The error was caused by a missing +: > > library(rgdal) > data(meuse.grid) > gridded(meuse.grid) <- TRUE > proj4string(meuse.grid) <- CRS("+init=epsg:28992") > ll <- spTransform(meuse.grid, CRS("proj=longlat +datum=WGS84")) > ll <- spTransform(meuse.grid, CRS("+proj=longlat +datum=WGS84")) > > which coerces to points first, as Mike said it should. > > Roger > > >> Any ideas what is the problem? >> Many thanks, >> >> Julian Burgos >> >> Julian Mariano Burgos >> Hafranns?knastofnunin/Marine Research Institute >> Sk?lagata 4, 121 Reykjav?k, Iceland >> S?mi/Telephone : +354-5752037 >> Br?fs?mi/Telefax: +354-5752001 >> >> Netfang/Email: jul...@hafro.is, jmbur...@uw.edu >> >> [[alternative HTML version deleted]] >> >> >> > -- > Roger Bivand > 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.biv...@nhh.no > > -- Julian Mariano Burgos Hafrannsóknastofnunin/Marine Research Institute Skúlagata 4, 121 Reykjavík, Iceland Sími/Telephone : +354-5752037 Bréfsími/Telefax: +354-5752001 Netfang/Email: jul...@hafro.is, jmbur...@uw.edu [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo