Berta
2006-Oct-18 10:27 UTC
[R] conversion of LL coordenates to UTM problems (ED50-WGS84 format)
Hi R-Users, I have plotted a region whose polygon coordinates are given in shp format ED50 UTM (zone=30) ) using "readShapePoly" in library(maptools). Now I need to plot a set of points in that region (my.dataframe, with X and Y geographic coordinates), which have been read using GPS in Longitud-Latitud form (using WGS84 system), so I first need to convert these Longitud-Latitud data into UTM data. To do so, I use package PBSmapping: attr(my.dataframe, "projection") <-"LL" attr(my.dataframe, "zone") <- 30 my.dataframe<-as.PolySet(my.dataframe) my.dataframeUL<-convUL(my.dataframe) obtaining the UTM coordinates. But when I plot them in the polygon region, points seem to be badly located. I suspect it is due to the ED50 UTM of the polygon versus WGS84 coordenates of the points. If this is the problem, is there a way to convert them into the same format? It it is not the problem, what am I doing wrong? Thanks a lot in advance. Berta. [[alternative HTML version deleted]]
Roger Bivand
2006-Oct-18 11:06 UTC
[R] conversion of LL coordenates to UTM problems (ED50-WGS84 format)
On Wed, 18 Oct 2006, Berta wrote:> Hi R-Users, I have plotted a region whose polygon coordinates are given > in shp format ED50 UTM (zone=30) ) using "readShapePoly" in > library(maptools). > > Now I need to plot a set of points in that region (my.dataframe, with X > and Y geographic coordinates), which have been read using GPS in > Longitud-Latitud form (using WGS84 system), so I first need to convert > these Longitud-Latitud data into UTM data. To do so, I use package > PBSmapping: > > attr(my.dataframe, "projection") <-"LL" > attr(my.dataframe, "zone") <- 30 > my.dataframe<-as.PolySet(my.dataframe) > my.dataframeUL<-convUL(my.dataframe) > > obtaining the UTM coordinates. But when I plot them in the polygon > region, points seem to be badly located. I suspect it is due to the > ED50 UTM of the polygon versus WGS84 coordenates of the points. If this > is the problem, is there a way to convert them into the same format? It > it is not the problem, what am I doing wrong?If the differences are in a few hundreds of metres, not transforming between ellipsoid definitions is the most likely cause. If you are willing to use the rgdal package, you will find the ED50 UTM zone 30 string is: "+proj=utm +zone=30 +ellps=intl +units=m towgs84=-87,-98,-121,0,0,0,0" and the WGS84/LL string is "+proj=longlat +datum=WGS84" Then for your GPS data as a SpatialPointsDataFrame with its coordinate reference system set, spTransform() should do what you want. See also the note by Edzer Pebesma and myself in R News in November 2005 on sp classes. Please consider following this up on the R-sig-geo list.> > Thanks a lot in advance. > Berta. > > [[alternative HTML version deleted]] > > ______________________________________________ > 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 > and provide commented, minimal, self-contained, reproducible code. >-- 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