Thursday, December 20, 2012

Mapping GPS Tracks in Google Earth

Even though I find the R solution easier, I'm sure not everyone agrees with me, so here's the Google Earth way to import a bunch of GPS tracks and map them:

Export to TCX

From inside Garmin Training Center or other GPS device software, export a huge TCX file with all your tracks.

Mapping in Google Earth

Opening your TCX file

Select File -> Open. Change the dropbox for "Files of type" to "Gps", and then find your file and open it. Make sure the "Create KML LineStrings" box is checked and the "Create KML Tracks" box is unchecked. This will save us some work later.

Import settings

Next, zoom in, zoom out, and recenter as desired. If you want North to be up, you can click the "N" in the compass in the upper right. 

In the layers (bottom left), I personally like to check Roads and uncheck everything else.

In the places (just above layers), right click "GPS device" and select "Properties". Click over to the "Style, Color" tab, and then click "Share Style".

Share style

I like to use the following settings:

Lines:
  • Color: red
  • Width: 3.0
  • Opacity: 100%
Label:
  • Opacity: 0%
Icon:
  • Opacity: 0%
Example style and color settings

Make sure you've selected all the dates you want on the date slider. Then you can select "Print" to export to a PDF, or you can take a screenshot.

Export image
Date slider and final map
And that's all there is to it. Large maps may take a long time to load and edit.


--
This post is one part of my series on Mapping GPS Tracks.

Thursday, December 13, 2012

Mapping GPS Tracks in R

This is an explanation of how I used R to combine all my GPS cycling tracks from my Garmin Forerunner 305.

Converting to CSV

You can convert pretty much any GPS data to .csv by using GPSBabel. For importing directly from my Garmin, I used the command:

gpsbabel -t -i garmin -f usb: -o unicsv -F out.csv

[Note: you'll probably need to work as root to access your device directly]

For importing from a .tcx file, you can use:

gpsbabel -t -i gtrnctr -f test2.tcx -o unicsv -F old.csv

Mapping in R

After converting to .csv, we'll have a file with several columns, such as latitude, longitude, date, and time. We can now easily import this into R.

gps <- read.csv("out.csv", 
 header = TRUE)

Next we want to load up ggmap and get our base map. To determine how zoomed in we are, we can set zoom and size. We can also choose the maptype, with options of terrain, satellite, roadmap, or hybrid (satellite + roadmap).

library(ggmap)
mapImageData <- get_googlemap(center = c(lon = median(gps$Longitude), lat = median(gps$Latitude)),
 zoom = 11,
# size = c(500, 500),
 maptype = c("terrain"))

I chose to set the center of the map to the median of my latitudes and the median of my longitudes. I've done some biking when traveling, so median made more sense for me than mean.
Finally we want to map our GPS data. There are several pch options to try.

ggmap(mapImageData,
 extent = "device") + # takes out axes, etc.
 geom_point(aes(x = Longitude,
  y = Latitude),
 data = gps,
 colour = "red",
 size = 1,
 pch = 20)

All my metro Atlanta bike rides
Previously, I've used Google Earth to create these maps, but I actually found it to be easier and way less time and resource efficient to do it in R. The only tricky part was converting the data into .csv, and there are other ways to do that, if GPSBabel isn't working for you. You might also be interested in trying Google Earth for mapping your tracks, instead of R.

Here's the gist with the code.


--
This post is one part of my series on Mapping GPS Tracks.

Citations and Further Reading

Thursday, December 6, 2012

WorkFlowy (or How I Organize Everything)

Being organized is crucial to doing a PhD.

One of the main ways I get and stay organized is by using WorkFlowy. WorkFlowy is a simple (perhaps startlingly simple) webapp that can function as to-do list, planning software, and outliner.

I've tried tons of to-do apps for desktop and mobile, but I've found I always revert to post-its and a todo.txt. WorkFlowy is the first service I've found that has changed that. It's pretty similar to a text file, but easier to navigate.



How I use WorkFlowy

To-do list

For my to-do list, I have one list for each week and then one list inside that for each day. It's easy to move stuff from day to day. When I finish items, I check them off.


When I'm finished with a week, I move it to a completed list at the bottom of my WorkFlowy. Since I mark off items as I finish them instead of deleting them, this gives me a quick way to look through and see what I've accomplished in the past week. This is helpful for self-assessment and for preparing for meetings with committee members.


You can also get WorkFlowy to send you a daily email with summaries of your changes.

WorkFlowy settings

Organizing papers

I tend toward being an excessive outliner. I outline my papers or sections of papers down to the paragraph or even sentence level before I write them. Some people prefer the edit-and-edit-again route, but I've found that outlining works better for me, personally.

In the preliminary stages of a paper, I use WorkFlowy for my outlines.

I have one list for each paper I have planned. Inside each list, I include things like a summary of the paper, research questions, hypotheses, possible data sources, variables, literature citations, possible cases to analyze, and a to-do list of things I need to remember to do.

Other features

Sharing

WorkFlowy lists can also be shared and used for collaboration. Free accounts can share through links that are accessible to anyone using the link. This link feature can either allow other people to edit the list or only view it. Paid accounts can also share privately to email addresses, with login required to view or edit.

Backup

Paid accounts can have automatic backup to Dropbox. Any user can export manually as text at any time.


Full disclosure: I don't work for WorkFlowy. I'm not receiving anything monetary for this post; nor am I receiving anything at all other than some extra WorkFlowy items if you sign up using my referral link. And I've referred enough people at this point that I don't even really need those. I just like to use the link to see how many people decide to try the service based on my opinions. (Also, you get more items if you use the link, as well.) I wrote this post for the same reason I write all my blog posts: to document what I've been up to and hopefully help someone along the way.