[R-sig-Geo] convUL to convert UTM in Lat/Long

Berta ibanez at bioef.org
Mon Jan 22 17:36:55 CET 2007


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

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




More information about the R-sig-Geo mailing list