I apologize in advance for my beginner question, but R spatial analysis is completely new to me.
I'm trying to convert an entire dataset (lat,long) into UTM for Ecuador (zone=17). My code below is only converting the first lat/long coordinates. Any advice would be greatly appreciated!
require(proj4)
require(rgdal)
require(sp)
require(proj4)
## Load dataset, total h7_x length = 327463
h7 <- read.csv('h7.csv', header=T)
h7 <- data.frame(x=h7$h7_x, y=h7$h7_y)
## Convert Lat/Long to UTM
proj4string <- "+proj=utm +zone=17 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
## Transformed data
pj.h7 <- project(h7, proj4string, inverse=TRUE)
latlon.h7 <- data.frame(lat=pj.h7$y, lon=pj.h7$x)
You can do this:
And now a reproducible example (this is how you should set up a question, it is not helpful to refer to files that others do not have.)