UTM to longitude latitude R-code

UTM-long.lat conversions

Option 1. Work with original dataframe that has locations as UTM


utms <- SpatialPoints(data[, c(“long”, “lat”)], proj4string=CRS(“+proj=utm +zone=10”)) #create UTM matrix

longlats <- spTransform(utms, CRS(“+proj=longlat”)) #transform

Option 2. Generate a new dataframe and use coordinates function instead (preserves other vectors in dataframe)

#convert UTM to long.lat

mapdata <- data

coordinates(mapdata) <- ~long+lat #similar to SpatialPoints

proj4string(mapdata) <- CRS(“+proj=utm +zone=10”) #assign projection and coordinate reference system

longlats <- spTransform(mapdata, CRS(“+proj=longlat”)) #transform

About lortie

ecologist. runner.

Posted by in research