[R-sig-Geo] [R] Using transform on spproj package.

Roger Bivand Roger.Bivand at nhh.no
Fri Jun 10 08:44:39 CEST 2005


On Thu, 9 Jun 2005, Ernesto Jardim wrote:

> Hi,
> 
> Following the advice from Roger I'm posting this issue on r-sig-geo.
> 
> The previous thread is below.
> 
> Responding Roger, yes you're correct these locations are near Cabo de 
> Sines, so I should correct the proj4string to latlon.
> 
> However my main issue still exists. Why the transform is working on X only ?

Well, since +proj=merc is in metre units measured from its origin (so x is 
8 metres west of the white line outside the Greenwich observatory) and y 
is just north of the equator, all +proj=utm is doing is changing the x 
origin to about 12 degrees west, and finding that Greenwich is 1505 km 
further east. The distance north of the equator doesn't change. But in 
fact the input data are measured in decimal degrees in latlong, not metres 
measured from the intersection of the line through Greenwich and the 
equator. I sometimes think of these things like time zones (and daylight 
saving time) in two dimensions.

Hope this helps,

Roger

> 
> EJ
> 
> ps: I'm using linux with R2.1.0 and I'm new to the sp family.
> 
> On Thu, 9 Jun 2005, Ernesto Jardim wrote:
> 
> > Hi,
> > 
> > I'm trying to use transform my mercator locations into utm but I'm doing 
> > something wrong because only x is transformed ... see
> 
> Two points: I think you are getting the transform you specify, from
> +proj=merc to +proj=utm with a different x origin - I suspect you meant
> +proj=latlong for the input data. If the coordinates below are somewhere
> off Cabo de Sines, they are latlong.
> 
> Second, spproj is not on CRAN, so either the R-spatial-dev mailing list on
> sourceforge (where spproj and friends are living while they grow up) or
> the R-sig-geo list might have been a good choice. Please consider
> continuing this on R-sig-geo.
> 
> Best wishes,
> 
> Roger
> 
> > 
> >  > xy.sp
> > SpatialPoints:
> >         loni  lati
> >   [1,] -8.85 38.16
> >   [2,] -9.19 37.99
> >   [3,] -9.11 37.97
> >   [4,] -9.06 38.15
> >   [5,] -9.03 37.87
> >   [6,] -9.14 37.81
> >   [7,] -9.09 37.70
> >   [8,] -8.95 37.45
> >   [9,] -9.17 37.37
> > [10,] -9.00 37.34
> > Coordinate Reference System (CRS) arguments: +proj=merc +datum=WGS84
> >  > transform(xy.sp, CRS("+proj=utm +zone=29"))
> > SpatialPoints:
> >           loni     lati
> >   [1,] 1505638 38.62347
> >   [2,] 1505638 38.45141
> >   [3,] 1505638 38.43116
> >   [4,] 1505638 38.61335
> >   [5,] 1505638 38.32995
> >   [6,] 1505638 38.26922
> >   [7,] 1505638 38.15788
> >   [8,] 1505638 37.90485
> >   [9,] 1505638 37.82388
> > [10,] 1505638 37.79351
> > Coordinate Reference System (CRS) arguments:  +proj=utm +zone=29 
> > +ellps=WGS84
> > 
> > What am I doing wrong ?
> > 
> > Thanks
> > 
> > EJ
> > 
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> > 
> 
> 

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