Guest User

Untitled

a guest
May 25th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. WGS2UTM <- function(df, WGS_coords){
  2. temp <- sp::SpatialPointsDataFrame(coords = WGS_coords, data = df,
  3. proj4string = CRS("+proj=longlat
  4. +ellps=WGS84 +datum=WGS84 +no_defs"))
  5. temp <- spTransform(temp, CRS(as.character(unique(temp@data$EPSG_UTM))))
  6. df$UTM_E <- sp::coordinates(temp)[,"x"]
  7. df$UTM_N <- sp::coordinates(temp)[,"y"]
  8. return(df)
  9.  
  10. UTM = NULL
  11.  
  12. df_list <- split(data, data$EPSG_UTM)
  13. for (i in 1:length(df_list)){
  14. t <- WGS2UTM(df_list[[i]],data.frame(df_list[[i]])[,c("x","y")])
  15. UTM=rbind(UTM,t)
  16. }
  17. data.cbind <- cbind(data,UTM)
Add Comment
Please, Sign In to add comment