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

Roger Bivand Roger.Bivand at nhh.no
Fri May 8 08:02:03 CEST 2009


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


More information about the R-sig-Geo mailing list