Not sure what's going on here, I need to investigate. But this work-around, which replicates the essence of projectRaster works for me:
library(rgdal) x <- raster(ymn=60) res(x) <- 0.25 xy <- coordinates(x, sp=T) xypole <- spTransform(xy, projection(r, asText=F)) x[] <- extract(r, xypole, method='bilinear') plot(x) KML(x, 'tst.kml') Robert On Wed, Oct 19, 2011 at 11:24 AM, Roger Bivand <roger.biv...@nhh.no> wrote: > On Wed, 19 Oct 2011, Anthony Fischbach wrote: > > Thank you for the GRASS suggestion. >> It would also be straight forward in ArgGIS, but I seek to run this all in >> a >> scripting environment with the full flexibility of R such that I may >> automate the whole process. >> > > I have a feeling that this is stranding on the raster warping difficulty > seen in high latitudes. The projected cells have great difficulty in > "adapting" to longlat, for obvious reasons, as the output cells really need > to differ in shape and form. Would it be possible to "go vector" instead, > and project the vector entities? I have some slides from a course I gave > three years ago but I'm not sure if they are relevant. > > Roger > > > >> Following on the projectRaster idea, I have tried using the from and to >> options, first creating a from raster corresponding to the geographic >> extent >> and resolution of the desired output raster. >> >> ll_lt <- 30.98 >>> ll_ln <- 168.35 >>> ur_lt <- 33.92 >>> ur_ln <- 279.26 >>> rGeo <- raster(nrows=448, ncols=304, xmn=ll_ln, xmx=ur_ln, ymn=ll_lt, >>> ymx=ur_lt, crs="+proj=longlat +datum=WGS84") >>> ## look at the raster before projecting >>> rr >>> >> class : RasterLayer >> dimensions : 448, 304, 136192 (nrow, ncol, ncell) >> resolution : 25000, 25000 (x, y) >> extent : -3837500, 3762500, -5362500, 5837500 (xmin, xmax, ymin, >> ymax) >> coord. ref. : +proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 >> +y_0=0 >> +a=6378273 +b=6356889.449 +units=m +no_defs >> values : ...\SeaIce\NSIDC\NearRealTime\**nt_20111011.tif >> min value : 0 >> max value : 1 >> >>> ## Project >>> rgeo <- projectRaster(from=rr, to=rGeo, method= 'bilinear') >>> rgeo >>> >> class : RasterLayer >> dimensions : 448, 304, 136192 (nrow, ncol, ncell) >> resolution : 0.3648355, 0.0065625 (x, y) >> extent : 168.35, 279.26, 30.98, 33.92 (xmin, xmax, ymin, ymax) >> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 >> values : in memory >> min value : 0 >> max value : 0 >> >> It fails to populate with the data. >> >> ----- >> Tony Fischbach, Wildlife Biologist >> Walrus Research Program >> Alaska Science Center >> U.S. Geological Survey >> 4210 University Drive >> Anchorage, AK 99508-4650 >> >> afischb...@usgs.gov >> http://alaska.usgs.gov/**science/biology/walrus<http://alaska.usgs.gov/science/biology/walrus> >> -- >> View this message in context: http://r-sig-geo.2731867.n2.** >> nabble.com/Reading-National-**Snow-and-Ice-Data-Center-**binary-files-** >> tp6882737p6909785.html<http://r-sig-geo.2731867.n2.nabble.com/Reading-National-Snow-and-Ice-Data-Center-binary-files-tp6882737p6909785.html> >> Sent from the R-sig-geo mailing list archive at Nabble.com. >> >> ______________________________**_________________ >> R-sig-Geo mailing list >> R-sig-Geo@r-project.org >> https://stat.ethz.ch/mailman/**listinfo/r-sig-geo<https://stat.ethz.ch/mailman/listinfo/r-sig-geo> >> >> > -- > Roger Bivand > Department of Economics, NHH Norwegian School of Economics, > Helleveien 30, N-5045 Bergen, Norway. > voice: +47 55 95 93 55; fax +47 55 95 95 43 > e-mail: roger.biv...@nhh.no > > > ______________________________**_________________ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/**listinfo/r-sig-geo<https://stat.ethz.ch/mailman/listinfo/r-sig-geo> > [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo