[R-sig-Geo] Transforming coordinates

Steven J. Pierce pierces1 at msu.edu
Tue Jan 23 17:38:17 CET 2007


Hi folks,

I've read in a shapefile that was provided to me in the Michigan State Plane
(South) coordinate system using the following code. How would I now
transform the coordinates so that the point represented by [origin.x,
origin.y] becomes the new [0,0], and at the same time convert the units from
feet (the original units) to meters? 

# Define the projection details that match those attached to the shapefile I
received. 

projection.details <- paste("+proj=lcc", 
                            "+lat_1=42.10000000", 
                            "+lat_2=43.66666667", 
                            "+lat_0=41.50000000", 
                            "+lon_0=-84.36666667",
                            "+x_0=13123333.33333333", 
                            "+y_0=0.00000000", sep=" ")

# Read in the shapefile.

ESCA.boundaries <- readShapePoly("schoolbnd_new1.shp", 
                                 proj4string = CRS(projection.details),
                                 verbose=TRUE)

# Collect the coordinates for the new origin at the lower left corner of the
# study region and store them. 

origin.x <- bbox(ESCA.boundaries[16,])[1,1]
origin.y <- bbox(Longit.usable)[2,1]



Steven J. Pierce, M.S.
Doctoral Student in Ecological/Community Psychology
Department of Psychology
Michigan State University
240B Psychology Building
East Lansing, MI 48824-1116

E-mail: pierces1 at msu.edu
Web: http://www.psychology.msu.edu/eco/




More information about the R-sig-Geo mailing list