[R-sig-Geo] projection() and proj4string()

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sat May 29 19:10:07 CEST 2010


On Sat, May 29, 2010 at 6:02 PM, Agustin Lobo <alobolistas at gmail.com> wrote:
>
> So, if I correctly understand, projection() can be used to retrieve
> information
> from an sp object but not to assign that info to a sp object:
>> projection(a)
> [1] "+proj=utm +zone=31 +ellps=intl +units=m +no_defs"
>
>> projection(a) <- projection(a)
> Error in checkSlotAssignment(object, name, value) :
>  "crs" is not a slot in class "SpatialPoints"
> Calls: projection<- -> @<- -> slot<- -> checkSlotAssignment

 Read the source. "projection" does a bunch of class tests (sure sign
of a broken OO model), returning x at crs for BasicRaster and
x at proj4string for Spatial classes.

 However, "projection<-" doesn't. It tries to assign to x at crs whatever.

Barry



More information about the R-sig-Geo mailing list