[R-sig-Geo] Transforming from cartographic to arbitrary local coordinate system

Don MacQueen macq at llnl.gov
Mon Nov 19 22:27:13 CET 2007


I have virtually no experience with cartographic coordinate systems, 
and transforming them, so I would like to ask for some help.

Someone has supplied me with a shapefile. When I open it in Qgis, 
Qgis tells me its "spatial reference system" is:

   +proj=lcc +lat_1=35.4666666666667 +lat_2=34.0333333333333 
+lat_0=33.5 +lon_0=-118 +x_0=1999999.9371016 +y_0=499999.9843516001 
+ellps=GRS80 +to_meter=0.3048006 +no_defs

I can read it into R using
    tmp <- readShapeLines('filename',
                       proj4string=CRS(pstring))

where pstring is that thing that Qgis gave me.
plot(tmp) then gives a picture that makes sense.

I would like to give the thing a convenient (to me) local coordinate 
system. I have quite a few such objects (all with the same proj.4 
spatial reference string (or coordinate specification?). Some are 
lines objects, some are polygon objects, and the polygon objects have 
nested polygons ("holes" or "islands").

Pretend for the moment that the lines of my object represent borders 
of a rectangular shaped plot of land . The rectangle is tilted 
relative to north/south.

What I now would like to do is rotate and shift the rectangle so that 
its borders appear vertical and horizontal (my local axes are 
parallel to its borders), and so that it has a local origin near one 
of the corners. I guess this isn't a true cartographic projection (?).

Is there a way I can do this with spTransform(), by supplying an 
appropriate CRS argument?


Thanks
-Don
-- 
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062




More information about the R-sig-Geo mailing list