[R-sig-Geo] WGS84 conversion to UTM

ernesto ernesto at ipimar.pt
Thu Apr 13 12:38:56 CEST 2006


Taylor, RB wrote:

>Dear all,
>
>I'm a rather new user to R, so please excuse my ignorance. I understand
>in R there are different spatial packages that allow one to do a variety
>of spatial analyses. I have collected GPS in WGS84 in South Africa. I
>have the data in a tab-deliniated txt file (along with attribute data)
>and in .shp files. I want to be able to read the text file (or ascii)
>into R and then batch convert long lat to UTM (34 S), and then do some
>analyses in R. I can across the website
>http://r-spatial.sourceforge.net/xtra/xtra.RHnw.html#spproj, which seems
>quite good. But I don't seem to be able to replicate the same procedure
>with my files. Being fairly new to R, I am not all that familiar with
>the syntax so perhaps this is why I can't do it.
>
>Any help is appreciated,
>thanks
>
>PS I work in a windows environment
>
>--
>Rob Taylor
>

Hi Rob,

Take a look at the package "PBSmapping".

You'll need to create a data.frame with the names X and Y and add an
attribute "projection", then just convUL :-)

See my example:

mydf <- read.table(blah, blah, blah)
names(mydf) <- c("X","Y")
attr(mydf, "projection") <- c("LL")
mydf.utm <- convUL(mydf)

Regards

EJ




More information about the R-sig-Geo mailing list