Skip to content

Instantly share code, notes, and snippets.

@bmpvieira
Created August 16, 2012 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmpvieira/3374580 to your computer and use it in GitHub Desktop.
Save bmpvieira/3374580 to your computer and use it in GitHub Desktop.
Simple R script to convert Long/Lat to UTM format
#!/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