Skip to content

Instantly share code, notes, and snippets.

@sithjaisong
Last active March 31, 2017 01:55
Show Gist options
  • Save sithjaisong/adad59f77e84df8681d425d951ba1dfe to your computer and use it in GitHub Desktop.
Save sithjaisong/adad59f77e84df8681d425d951ba1dfe to your computer and use it in GitHub Desktop.
script to transform utm data to lat-long data
# ref:https://sites.google.com/a/lakeheadu.ca/yong-luo/blog/convert-utm-to-longlat-in-r
library(rgdal)
# prepare UTM coordinates matrix
utmcoor<-SpatialPoints(cbind(utmdata$X,utmdata$Y), proj4string=CRS("+proj=utm +zone=30")) # UTM zone Central Thailand: 47P
#utmdata$X and utmdata$Y are corresponding to UTM Easting and Northing, respectively.
#zone= UTM zone
# converting
longlatcoor<-spTransform(utmcoor,CRS("+proj=longlat"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment