[R-sig-Geo] R 3.0.0 and spatial classes

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sun Dec 16 21:15:27 CET 2012


On Sun, Dec 16, 2012 at 5:19 PM, Edzer Pebesma
<edzer.pebesma at uni-muenster.de> wrote:
> Hi Barry, that sounds like a great project. As of your (only) example, I
> already see, after loading package raster:
>
>> showMethods(proj4string)
> Function: proj4string (package sp)
> obj="Raster"
> obj="Spatial"
>
> Loading Tcl/Tk interface ... done
>> getMethod(proj4string, "Raster")
> Method Definition:
>
> function (obj)
> {
>     projection(obj)
> }
> <environment: namespace:raster>
>
> Signatures:
>         obj
> target  "Raster"
> defined "Raster"
>
> or do you suggest that sp should adopt the use of projection() as well?
>
> I'm looking forward to many reactions too, but will draw my conclusions
> if there aren't any.

 I'm not sure I like 'projection' at all. Technically these are
spatial coordinate reference systems. I think I would prefer to assign
a coordinate reference system with the CRS<- function:

CRS(foo) = proj4("+init=epsg:27700")

that would allow the possible use of other reference system specs, e.g.

CRS(foo) = wktProj('GEOGCS["WGS 84".... etc]')

but of course things like spTransform would have to understand how to
convert from things that aren't specified by a proj4 object, so they'd
probably have to error.

The proj4 and wktProj functions here would return an object of class
"CRS" and "proj4"/"wktProj". The thing that's nagging me now is the
use of a function called CRS that isn't a constructor for CRS objects,
so maybe:

setCRS(foo)=proj4("+init=epsg:4326")

Hmm.

Barry



More information about the R-sig-Geo mailing list