Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WGS2UTM <- function(df, WGS_coords){
- temp <- sp::SpatialPointsDataFrame(coords = WGS_coords, data = df,
- proj4string = CRS("+proj=longlat
- +ellps=WGS84 +datum=WGS84 +no_defs"))
- temp <- spTransform(temp, CRS(as.character(unique(temp@data$EPSG_UTM))))
- df$UTM_E <- sp::coordinates(temp)[,"x"]
- df$UTM_N <- sp::coordinates(temp)[,"y"]
- return(df)
- UTM = NULL
- df_list <- split(data, data$EPSG_UTM)
- for (i in 1:length(df_list)){
- t <- WGS2UTM(df_list[[i]],data.frame(df_list[[i]])[,c("x","y")])
- UTM=rbind(UTM,t)
- }
- data.cbind <- cbind(data,UTM)
Add Comment
Please, Sign In to add comment