[R-sig-Geo] convUL to convert UTM in Lat/Long
Roger Bivand
Roger.Bivand at nhh.no
Mon Jan 22 18:38:15 CET 2007
On Mon, 22 Jan 2007, Berta wrote:
> Thanks Roger, it works perfectly. Just one thing. If I use the second
> option, I obtain (note that it is for other data point, for which I have the
> conversion from the GPS tool)
>
> library(rgdal)
> datainUTM<-data.frame(cbind(c(559835),c(4778818), c(0), c(1)))
> names(datainUTM)<-c("X", "Y", "PID", "POS")
> SP <- SpatialPoints(cbind(datainUTM$X, datainUTM$Y),
> proj4string=CRS("+proj=utm +zone=30"))
> spTransform(SP, CRS("+proj=longlat"))
>
> # coords.x1 coords.x2
> #[1,] -2.263995 43.15975
> #Coordinate Reference System (CRS) arguments: +proj=longlat +ellps=WGS84
It doesn't look as though this is the ED50 to WGS84 datum shift that you
gave in your email that crossed with my reply. It may be that you need to
find a correct +towgs84 for your location - it turns out that there are
various ones across Europe - googling on "ED50 towgs84" gives lots of
different values. Are your GPS values degree+decimal minute:
43º 9.585' N; 02º 15840' H
which would be decimal degree:
43.15975; 2.2640
wouldn't it?
Roger
>
> Which differs from what my collages expected, as the GPS (they say) says
> that the conversion for that UTM coordenates is 43º 09585' N, 02º 15840' H,
> and I do not find any similarities (even trying to change from decimals to
> minutes or seconds). May be something is missing in the GPS translation. Any
> clue of what I am missing will be appreciated.
>
> Thank a lot for your help,
>
> Berta
>
>
>
>
>
>
> >
> > Yes, can be reproduced, I've CC'ed the maintainer. I can't see anything
> > wrong at the R level, but it seems that PBS is maybe expecting the UTM
> > coordinates in km not m:
> >
> > debug: if (inProj == "UTM") {
> > inXY <- inXY * 1000
> > toUTM <- FALSE
> > } else {
> > toUTM <- TRUE
> > }
> >
> > is rather tricky. Doing:
> >
> > datainUTM$X <- datainUTM$X/1000
> > datainUTM$Y <- datainUTM$Y/1000
> > convUL(datainUTM)
> >
> > does work.
> >
> > Another possibility is:
> >
> > library(rgdal)
> > SP <- SpatialPoints(cbind(datainUTM$X, datainUTM$Y),
> > proj4string=CRS("+proj=utm +zone=30"))
> > spTransform(SP, CRS("+proj=longlat"))
> >
> > Roger
> >
> >
> >>
> >> [[alternative HTML version deleted]]
> >>
> >> _______________________________________________
> >> 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