|
Dear Colleagues,
Good day! I have a data points collected using GPS..It was on latitude and longitude coordinate system ..I wonder if there's any function in R where I could convert those GPS data points to UTM (e.g. UTM Zone 51N)? Thanks in advance Arnold [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo |
|
The rgdal package has the project() function for direct conversion
to/from longlat (WGS84) - via the PROJ.4 library, via GDAL - all embedded in the package. library(rgdal) xy <- cbind(c(118, 119), c(10, 50)) project(xy, "+proj=utm +zone=51 ellps=WGS84") [,1] [,2] [1,] -48636.65 1109577 [2,] 213372.05 5546301 Be aware that that is a very minimal "PROJ.4" string (metres is assumed), and that "+proj=longlat +ellps=WGS84" is the assumed base coordinate system. FYI, in sp, there is spTransform() which can wrap the required back-projection and perform reprojections for more complicated data sets. See ?project and ?spTransform Cheers, Mike. On Tue, Mar 1, 2011 at 1:45 PM, Arnold Salvacion <[hidden email]> wrote: > Dear Colleagues, > Good day! > I have a data points collected using GPS..It was on latitude and longitude coordinate system ..I wonder if there's any function in R where I could convert those GPS data points to UTM (e.g. UTM Zone 51N)? > Thanks in advance > Arnold > > > > > [[alternative HTML version deleted]] > > > _______________________________________________ > R-sig-Geo mailing list > [hidden email] > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > > -- Michael Sumner Institute for Marine and Antarctic Studies, University of Tasmania Hobart, Australia e-mail: [hidden email] _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo |
|
I just noticed that proj4 package has been updated after several years of
stasis, this might be helpful if rgdal is overkill for you: library(proj4) ptransform(cbind(xy)/180*pi, "+proj=longlat +ellps=WGS84", "+proj=utm +zone=51 +ellps=WGS84") [,1] [,2] [,3] [1,] -48636.65 1109577 0 [2,] 213372.05 5546301 0 Note that the input coordinates are expected to be in radians - which is how PROJ.4 operates natively as I understand. The mapproj package is another old one that has been recently updated, another option that might be of use. Cheers, Mike. On Tue, Mar 1, 2011 at 2:08 PM, Arnold Salvacion <[hidden email] > wrote: > Hi Mike, > > > Thank you very much,,will try it and let you know what happens. > > Arnold > > --- On *Tue, 3/1/11, Michael Sumner <[hidden email]>* wrote: > > > From: Michael Sumner <[hidden email]> > Subject: Re: [R-sig-Geo] converting lat long points to UTM > To: "Arnold Salvacion" <[hidden email]> > Cc: [hidden email] > Date: Tuesday, March 1, 2011, 10:54 AM > > > The rgdal package has the project() function for direct conversion > to/from longlat (WGS84) - via the PROJ.4 library, via GDAL - all > embedded in the package. > > library(rgdal) > xy <- cbind(c(118, 119), c(10, 50)) > project(xy, "+proj=utm +zone=51 ellps=WGS84") > [,1] [,2] > [1,] -48636.65 1109577 > [2,] 213372.05 5546301 > > Be aware that that is a very minimal "PROJ.4" string (metres is > assumed), and that "+proj=longlat +ellps=WGS84" is the assumed base > coordinate system. > > FYI, in sp, there is spTransform() which can wrap the required > back-projection and perform reprojections for more complicated data > sets. > > See ?project and ?spTransform > > Cheers, Mike. > > On Tue, Mar 1, 2011 at 1:45 PM, Arnold Salvacion > <[hidden email]<http://mc/compose?to=arnold_salvacion@...>> > wrote: > > Dear Colleagues, > > Good day! > > I have a data points collected using GPS..It was on latitude and > longitude coordinate system ..I wonder if there's any function in R where I > could convert those GPS data points to UTM (e.g. UTM Zone 51N)? > > Thanks in advance > > Arnold > > > > > > > > > > [[alternative HTML version deleted]] > > > > > > _______________________________________________ > > R-sig-Geo mailing list > > [hidden email] <http://mc/compose?to=R-sig-Geo@...> > > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > > > > > > > > -- > Michael Sumner > Institute for Marine and Antarctic Studies, University of Tasmania > Hobart, Australia > e-mail: [hidden email] <http://mc/compose?to=mdsumner@...> > > > -- Michael Sumner Institute for Marine and Antarctic Studies, University of Tasmania Hobart, Australia e-mail: [hidden email] [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo |
|
In reply to this post by Arnold Salvacion
Hi Arnold
If i remember right, its in the Rgdal package. You need the librariy gdal in your system, this gave me some problems on Ubuntu Linux. Then what you are looking for is something like : points <- spTransform(points, CRS = ("+proj=longlat") remember that you have to give the right proj4string to your spatialDataPoints before. Hope this is right, but otherwise i will be corrected i am sure ;) Regards Jan 2011/3/1 Arnold Salvacion <[hidden email]> > Dear Colleagues, > Good day! > I have a data points collected using GPS..It was on latitude and longitude > coordinate system ..I wonder if there's any function in R where I could > convert those GPS data points to UTM (e.g. UTM Zone 51N)? > Thanks in advance > Arnold > > > > > [[alternative HTML version deleted]] > > > _______________________________________________ > R-sig-Geo mailing list > [hidden email] > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > > [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo |
|
In reply to this post by Arnold Salvacion
if you want to use Lat/Long data, you may also try the 'project'
function in the 'proj4' package: library(proj4) ## this is just very simple, because we don't want to depend on ## maps package, so we can't show more useful stuff.. data(state) s <- project(state.center, "+proj=merc", degrees=TRUE) plot(s, type='n', asp=1) text(s,, state.abb) (taken from '?project') Kinds, Mauricio -- ================================ Linux user #454569 -- Ubuntu user #17469 ================================ 2011/3/1 Arnold Salvacion <[hidden email]>: > Dear Colleagues, > Good day! > I have a data points collected using GPS..It was on latitude and longitude coordinate system ..I wonder if there's any function in R where I could convert those GPS data points to UTM (e.g. UTM Zone 51N)? > Thanks in advance > Arnold > > > > > [[alternative HTML version deleted]] > > > _______________________________________________ > R-sig-Geo mailing list > [hidden email] > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > > _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo |
| Powered by Nabble | Edit this page |
