[R] LAT/LON to UTM in R

MacQueen, Don macqueen1 at llnl.gov
Wed Nov 19 22:28:52 CET 2014

By the way, this question is more appropriate for R-sig-geo.

Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550

On 11/18/14, 8:20 AM, "Zilefac Elvis" <zilefacelvis at yahoo.com> wrote:

>I am trying to convert lat/lon to UTM but my results are extremely flawed.
>Is it because of wrong UTM zone or my lon points are negative?
>I read a shapefile from ESRI using:
>stations <- readOGR(".","stations")
>## +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
> How to convert to UTM the following lat/lon points? Reproducible example
>at the end.
>coordinates(xy) <- c("X", "Y")
>proj4string(xy) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84
>+no_defs")  ## for example
>res <- spTransform(xy, CRS("+proj=longlat +ellps=WGS84 +datum=WGS84
>as(res, "SpatialPoints")
>x<-as(res, "SpatialPoints")
>project(as.matrix(xy[,c("X","Y")]), "+proj=longlat +ellps=WGS84
>+datum=WGS84 +no_defs")
>Everything goes wrong with the values.
>Please help.
>R-help at r-project.org mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list