[R-sig-Geo] Lat / Long - x/y?

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Tue Dec 13 15:47:54 CET 2011


On Tue, Dec 13, 2011 at 12:52 PM, Sam smith <sam856040 at gmail.com> wrote:
> Hi,
>
> Thanks for this - yes i was looking to do a Projection from Decimal Degrees
> into spatial (xy) coordinates.
>
> I shall have a look at the package you suggested.

 You probably mean 'Cartesian x-y coordinates'. You'll need to find a
coordinate transformation (not a projection, strictly) to a more
Cartesian coordinate system. If your data are in the UK for example,
you'd use Ordnance Survey Grid References. If you have a spatial data
frame with a CRS properly defined you can transform with spTransform
and the appropriate EPSG code:

> ll
  coordinates A
1    (50, 23) a
2    (52, 26) b
> spTransform(ll,CRS("+init=epsg:27700"))
          coordinates A
1 (6273200, -1692000) a
2 (6301630, -1123490) b

 (these coordinates are nowhere near the UK so don't do that).

 For the rest of the planet, there's probably a UTM (Universal
Transverse Mercator) zone that will do the job. Not sure what you do
if you're working with polar bears or penguins - there's probably
other transformations for polar data...

Barry



More information about the R-sig-Geo mailing list