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

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Mon Dec 17 10:24:10 CET 2012


On Mon, Dec 17, 2012 at 4:05 AM, Robert J. Hijmans <r.hijmans at gmail.com> wrote:

>

>> that would allow the possible use of other reference system specs, e.g.
>>
>> CRS(foo) = wktProj('GEOGCS["WGS 84".... etc]')
>
>
> That is a transformation, so I would think:
>
>  foo = spTransform('GEOGCS["WGS 84".... etc]')
>
> and foo could be either of class 'character' (a.k.a. a proj4-string) or an
> object of class CRS
>

Not sure I get you here. There's more than one way to specify a
coordinate reference system than the Proj4 string. For example, if I
wanted to set the CRS of an object to be the same as that in a
Shapefile's .prj file I would have to load the shapefile into an SP
object and get the object's proj4string. Much nicer would be if I
could do something like:

setCRS(foo) = shapefileProj("foo.prj")

Where the shapefileProj function returns a CRS object from the file.
If there's an easy way of converting that to a Proj4 string, then
shapefileProj would do that and return an object of class
c("CRS","proj4"), otherwise it would be c("CRS","shpprj") and code
using it would scream if if didn't have a method that could deal with
that class.

The spatialreference.org site has over a dozen formats for each
reference spec (many of which are perhaps trivially translatable
between) but it might be nice to have code that could handle more than
just proj4 formats...


Barry



More information about the R-sig-Geo mailing list