Created
August 16, 2012 23:46
-
-
Save bmpvieira/3374580 to your computer and use it in GitHub Desktop.
Simple R script to convert Long/Lat to UTM format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/Rscript | |
# | |
#Copyright (c) 2012 Bruno Vieira [http://bmpvieira.com] | |
#License: MIT | |
#Description: Simple R script to convert Long/Lat to UTM format | |
require("PBSmapping") || install.packages("PBSmapping", dependencies=TRUE) && require("PBSmapping") | |
input <- commandArgs(TRUE)[1] | |
coord <- read.csv(input, header = TRUE) | |
attr(coord, "projection") <- "LL" | |
attr(coord, "zone") <- NA | |
coord.utm <- convUL(coord) | |
output <- sub(pattern = ".csv", replacement = ".utm.csv", x = input) | |
write.csv(coord.utm, output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment