[R-sig-Geo] Transforming coordinates

Roger Bivand Roger.Bivand at nhh.no
Wed Jan 24 19:00:51 CET 2007


On Wed, 24 Jan 2007, Steven J. Pierce wrote:

> 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? 

For exchanging data with others, it is usually best to use a standard 
format. Then the different data sources can be combined without jumping 
through hoops (e.g. GPS readings). So using a custom origin (moving x_0 
and y_0 doesn't necessarily seem like a good idea. If you are using a 
trend surface though in lm(), big values especially of y (feet or metres 
from the Equator in some projections) blow up by the cube unless the 
software is smart and rescales them on the fly (surf.ls in spatial and 
gstat are smart).

Roger

> 
> 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
> 
> 

-- 
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