[R-sig-Geo] Define projection using Raster package

Robert Hijmans r.hijmans at gmail.com
Fri May 8 07:13:25 CEST 2009


Tim,

"proj" is not a valid argument in raster(x, ... ) when x (the first
argument) is of class character (i.e. interpreted as a filename); but
I can add that argument. For now, what should work is:

r<-raster(paste(asc.in.dir, "\\", asc.in.files[i], sep=""))
projection(r) <- "+proj=tmerc +lat_0=0 +lon_0=0 +k=9996 +x_0=500000
+y_0=10000000"

Robert

On Fri, May 8, 2009 at 10:26 AM, Tim Sippel <tsippel at gmail.com> wrote:
> I need to take an ESRI grid (.asc) which is in geographic coordinates
> (lat/lon) and project it to UTM coordinates.  The following command is
> giving me an error saying I'm giving it an undefined argument.  I can read
> the raster without the projs arguement, but I'm stuck when adding that on.
>
>> r<-raster(paste(asc.in.dir, "\\", asc.in.files[i], sep=""),
> projs="+proj=tmerc +lat_0=0 +lon_0=0 +k=9996 +x_0=500000 +y_0=10000000")
> Error in .local(x, ...) :
>  unused argument(s) (projs = "+proj=tmerc +lat_0=0 +lon_0=0 +k=9996
> +x_0=500000 +y_0=10000000")
>
> Thanks,
>
> 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