Can anyone tell me what I am doing wrong when using spTransform? I need to transform points in Southern Mexico from UTM NAD27 to Long Lat WGS84.
Three small functions. NAD27_WGS84ll<-function(points){ coordinates(points)<-~x+y [EMAIL PROTECTED]<-CRS("+proj=utm +zone=15 +ellps=clrk66 +datum=NAD27 +units=m") spTransform(points, CRS("+proj=longlat +datum=WGS84"))} NAD27_NAD27ll<-function(points){ coordinates(points)<-~x+y [EMAIL PROTECTED]<-CRS("+proj=utm +zone=15 +datum=NAD27 +units=m") spTransform(points, CRS("+proj=longlat +datum=NAD27"))} NAD27_WGS84<-function(points){ coordinates(points)<-~x+y [EMAIL PROTECTED]<-CRS("+proj=utm +zone=15 +datum=NAD27 +units=m") spTransform(points, CRS("+proj=utm +zone=15 +datum=WGS84 +units=m"))} When I test them I get strange results. x<-c(541987,541970) y<-c(1846598,1846799) points<-data.frame(x,y) NAD27_WGS84ll(points) SpatialPoints: x y [1,] -92.60617 16.70272 [2,] -92.60633 16.70454 Coordinate Reference System (CRS) arguments: +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 NAD27_NAD27ll(points) SpatialPoints: x y [1,] -92.60617 16.70272 [2,] -92.60633 16.70454 Coordinate Reference System (CRS) arguments: +proj=longlat +datum=NAD27 +ellps=clrk66 [EMAIL PROTECTED],@alaska,@ntv2_0.gsb,@ntv1_can.dat The results are the same, even though one function involves a datum shift and the other doesn't. The difference between NAD27 and WGS84 in Southern Mexico should be around 200m N and 20m E. But I get points-as.data.frame(NAD27_WGS84(points)) x y 1 0.5857494 -112.2658 2 0.5855395 -112.2768 Thanks for any advice. Duncan Golicher -- Dr Duncan Golicher Ecologia y Sistematica Terrestre Conservación de la Biodiversidad El Colegio de la Frontera Sur San Cristobal de Las Casas, Chiapas, Mexico Email: [EMAIL PROTECTED] Tel: 967 674 9000 ext 1310 Fax: 967 678 2322 United Kingdom Skypein; 020 7870 6251 Skype name: duncangolicher _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo