[R] Converiting longitude/latitude to utm

David L Carlson dcarlson at tamu.edu
Tue Jun 5 16:15:54 CEST 2012


You might try R-Sig-Geo for the reasons, but you need to include the UTM
zone to convert:

SP<-SpatialPoints(cbind(126.59,-14.30),proj4string=CRS("+proj=longlat"))
SP

SpatialPoints:
     coords.x1 coords.x2
[1,]    126.59     -14.3
Coordinate Reference System (CRS) arguments: +proj=longlat +ellps=WGS84

coordinatesUTM<-spTransform(SP,CRS("+proj=utm +zone=52"))
coordinatesUTM

SpatialPoints:
     coords.x1 coords.x2
[1,]  240015.6  -1582256
Coordinate Reference System (CRS) arguments: +proj=utm +zone=52
+ellps=WGS84

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352



> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Boris Beranger
> Sent: Tuesday, June 05, 2012 3:29 AM
> To: R-help at r-project.org
> Subject: [R] Converiting longitude/latitude to utm
> 
> Dear all,
> 
> I have been trying to convert coordinates from longitude/latitude to
> utm
> but I got an error. As soon as the longitude coordinate is greater than
> 90,
> I get the folloowing error message:  "error in pj_transform: latitude
> or
> longitude exceeded limits"
> 
> Here is what I did:
> 
>  SP<-SpatialPoints(cbind(126.59,-
> 14.30),proj4string=CRS("+proj=longlat"))
> coordinatesUTM<-spTransform(SP,CRS("+proj=utm"))
> 
> Error in spTransform(SP, CRS("+proj=utm")) :
>   error in pj_transform: latitude or longitude exceeded limits
> 
> Can someone explain me what I did wrong? I am using coordinates of
> Australia so the range of my longitudes is around [110,150] and the one
> of
> my latitudes [-10,-45].
> 
> Thanks in advance,
> 
> Cheers,
> Boris
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list