Browse files

commit-message.txt

  • Loading branch information...
1 parent 17fb11e commit 51b0066620d231ae853aee02551e6c55712af1ee @mollietaylor committed Oct 28, 2013
Showing with 488 additions and 9,452 deletions.
  1. BIN Maps/auto.png
  2. BIN Maps/default.png
  3. +450 −9,435 allTracks.csv
  4. +7 −3 functions.R
  5. +0 −10 import.R
  6. +31 −4 map.R
View
BIN Maps/auto.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN Maps/default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
9,885 allTracks.csv
450 additions, 9,435 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
10 functions.R
@@ -5,16 +5,20 @@ appendTrack <- function(filenames) {
# delete original extension and add new one:
newFilename <- paste(sub(paste("\\.", extensions[fileNumber], sep = ""), "", filenames[fileNumber]), ".csv", sep = "")
- gpsbabelCommand <- paste("sudo gpsbabel -t -i ",
+ if (extensions[fileNumber] != "csv") {
+ gpsbabelCommand <- paste("sudo gpsbabel -t -i ",
extensions[fileNumber],
" -f '",
- gpxFilenames[fileNumber],
+ filenames[fileNumber],
"' -o unicsv -F '",
newFilename,
"'",
sep = "")
- system(gpsbabelCommand)
+ system(gpsbabelCommand)
+ } else {
+ newFilename <- filenames[fileNumber]
+ }
# add variables (based on GPS/addvariables.R)
track <- read.csv(newFilename,
View
10 import.R
@@ -5,22 +5,12 @@
# All rights reserved
#
-# system() # intern = TRUE?
-# file1 <- read.csv(file.choose(),
- # header = TRUE)
-
-# appending <- readline("Append? (y/n) ")
-
source("functions.R")
-# file.choose()
library(tcltk)
# this means i should be able to remove the loop below:
# filenames <- lapply(tk_choose.files(caption = "Choose X"), function)
filenames <- tk_choose.files(caption = "Choose files")
-# grepl regexpr gregexpr
-
-
appendTrack(filenames)
View
35 map.R
@@ -25,8 +25,9 @@ allTracks$Longitude <- ifelse(is.na(allTracks$Seg), NA, allTracks$Longitude)
library(ggmap)
-# create directory "Maps" if it does not exist:
-dir.create("./Maps")
+# let user choose directory to save in:
+library(tcltk)
+mapDir <- tk_choose.dir()
# default map:
mapImageData <- get_map(location = c(lon = meanLon,
@@ -50,7 +51,7 @@ dir.create("./Maps")
colour = "#F8971F", #F8971F F4640D
size = 0.8,
pch = 20)
- dev.copy(png, "Maps/default.png")
+ dev.copy(png, paste(mapDir, "/default.png", sep = ""))
dev.off()
@@ -80,6 +81,32 @@ mapZoom <- floor(13 - log2(10 * mapWidth))
colour = "#F8971F", #F8971F F4640D
size = 0.8,
pch = 20)
- dev.copy(png, "Maps/auto.png")
+ dev.copy(png, paste(mapDir, "/auto.png", sep = ""))
dev.off()
+# last month:
+allTracks$Date <- as.Date(allTracks$Date, "%Y/%m/%d")
+lastMonth <- allTracks[which(allTracks$Date >= Sys.Date() - 30),]
+ mapImageData <- get_map(location = c(lon = mean(c(lonLoRange, lonHiRange)),
+ lat = mean(c(latLoRange, latHiRange))), # maybe use 20th/80th percentile or something instead of min/max
+ zoom = mapZoom,
+ # size = c(500, 500),
+ maptype = c("toner"), #toner, watercolor
+ source = c("stamen"))
+ ggmap(mapImageData,
+ extent = "device", # takes out axis, etc.
+ darken = c(0.6, "white")) + # makes basemap lighter
+ geom_path(aes(x = Longitude,
+ y = Latitude),
+ data = allTracks,
+ colour = "black", #F8971F F4640D
+ size = 1.2,
+ pch = 20) +
+ geom_path(aes(x = Longitude,
+ y = Latitude),
+ data = allTracks,
+ colour = "#F8971F", #F8971F F4640D
+ size = 0.8,
+ pch = 20)
+ dev.copy(png, paste(mapDir, "/last-month.png", sep = ""))
+ dev.off()

0 comments on commit 51b0066

Please sign in to comment.