[R-sig-Geo] Transforming coordinates

Steven J. Pierce pierces1 at msu.edu
Wed Jan 24 16:55:12 CET 2007


Thanks Roger. The immediate purpose is to produce a map of the neighborhoods
where our study is located with the x & y axes labeled so as to clearly
illustrate the size of the study region. But, I'll also be overlaying some
point pattern data collected via surveys of neighborhood residents and want
to do some trend surface modeling, variogram modeling, and kriging to
examine the spatial structure of certain survey measures. 

I've gotten the impression that in analyzing those kinds of data, such
coordinate transformations are not unusual. But, the spatial analysis class
I took generally used example datasets where coordinate systems were already
set up and never discussed that explicitly, so I'm trying to learn some of
this stuff on my own. 

Is there a better way to set up the coordinate system for this sort of
analysis? 

Steven J. Pierce
E-mail: pierces1 at msu.edu

-----Original Message-----
From: Roger Bivand [mailto:Roger.Bivand at nhh.no] 
Sent: Tuesday, January 23, 2007 4:22 PM
To: Steven J. Pierce
Cc: r-sig-geo at stat.math.ethz.ch
Subject: Re: [R-sig-Geo] Transforming coordinates

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