[R-sig-Geo] Transforming coordinates
Roger Bivand
Roger.Bivand at nhh.no
Tue Jan 23 22:21:48 CET 2007
On Tue, 23 Jan 2007, Steven J. Pierce wrote:
> 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?
The Michigan State Plane South NAD83 in feet seems to be EPSG code 2898,
while the same in metres is EPSG code 2809. So assign "+init=epsg:2898" to
the shapefile, and use spTransform() in rgdal to change to
"+init=epsg:2809". From there on take the full parameters of code 2809,
and change x_0= and y_0= to the bounding box bbox() minimum values in
metres, and spTransform() again. I guess you need to do this, but it isn't
clear why.
>
> # 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/
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list