Skip to content
Back to formatted view

Raw Message

Message-ID: <alpine.LRH.2.00.0905080756390.32137@reclus.nhh.no>
Date: 2009-05-08T06:02:03Z
From: Roger Bivand
Subject: Define projection using Raster package
In-Reply-To: <dc22b2570905072213j50335f72sa738b4a39cd48d8c@mail.gmail.com>

On Fri, 8 May 2009, Robert Hijmans wrote:

> 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"

This answers the question of how to set the coordinate reference system. 
However, I think that Tim is also asking about how to warp from 
geographical coordinates to the specified projected coordinates. Should he 
use projectRaster() to do this?

Roger

>
> 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
>>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
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.Bivand at nhh.no