Skip to content
Prev 1803 / 29559 Next

LL to UTM

Gabor, 

I've used convUL in the PBSmapping package to convert from UTM to
lat/lon for some weather data I was playing with. It will also convert
from lat/lon to UTM (I haven't tried that direction though).

Here's the code I used:

  library(PBSmapping)  
  subs = read.csv("ngrid/SubAsPoints.csv", comment="")
  names(subs) = tolower(names(subs))
  attr(subs, "zone") = 18
  attr(subs, "projection") = "UTM"
  subs$X = subs$point_x * 12 * 2.54 / 1e5 # convert to km
  subs$Y = subs$point_y * 12 * 2.54 / 1e5
  subs$sub_num = subs$sub_number
  subs = convUL(subs)

Here's the code from the help file for converting the other way:

  data(nepacLL)
  #--- set the zone attribute
  attr(nepacLL, "zone") <- 9
  #--- convert to UTM
  nepacUTM <- convUL(nepacLL)

- Tom

Tom Short
EPRI