[R-sig-Geo] Raster package, projectRaster() filetype issue

Robert Hijmans r.hijmans at gmail.com
Tue May 19 02:17:44 CEST 2009


Tim,
Thanks, that is a bug. It has been fixed in Version 0.8.9-20
(19-May-2009). Automatic install should be available from r-forge in
24 hours.
Robert

On Tue, May 19, 2009 at 7:28 AM, Tim Sippel <tsippel at gmail.com> wrote:
> I'm using the raster package version 0.8.9-17 on R2.9.0. While using the
> function projectRaster I'm projecting my data and need to output a new ESRI
> grid (.asc).  The following code I think should do the job, but it is
> writing two different files (.grd and .gri) instead of the .asc I need.  Is
> this a bug?
>
> asc.in.dir<-"C:\\..\\raster.directory"
> asc.out.dir<-"C:\\...\\raster.directory\\UTMprojected"
> asc.in.files<-dir(asc.in.dir, pattern='.asc$')
> r<-raster(paste(asc.in.dir, "\\", asc.in.files[i], sep=""))
> r[]<-1:ncell(r)
> projection(r) <- "+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"
> newproj <- "+proj=sinu"
> projext <- projectExtent(object=r, projs=newproj)
> projras <- projectRaster(from=r, to=projext, method="ngb", filetype="ascii",
>
>  filename=paste(asc.out.dir, "\\UTM <file://utm/>", asc.in.files[i],
> sep=""))
>
> Tim
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> 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