# GEOG 566

April 18, 2018

### Visualizing a recreationists movement through space and time

Filed under: 2018,Exercise/Tutorial 1 2018 @ 1:30 pm

The question I asked for this exercise was how to plot and visually represent recreationists’ movements through time and space.  My goal was to plot five individual GPS tracks onto a graph with X & Y coordinates (Long & Lat), and a Z-coordinate representing time. To visualize and identify patterns within and between each individual’s movements through time, I aimed to represent change in time using color gradients. In order to make comparisons between the five tracks, I also sought to standardize the color ramp so that each GPS track was color coded using the same timestamp parameters.

For this exercise, I used five GPS tracks that were collected on July 19, 2017 at String & Leigh Lake in Grand Teton National Park.

Name of the tool or approach that you used.

Although the goal for this exercise was seemingly simple (visualizing a person’s movement through space and time) the biggest challenge for me was learning how to produce this result using R. I am still familiarizing myself to this software, so the learning curve was steep throughout all phases of the process.

The packages I used in R were:

ggmap – to load in a satellite image of the location where the GPS tracks were collected

ggplot – to plot the tracks onto a graph

leaflet – to create an interactive plot of the GPS tracks

Brief description of steps you followed to complete the analysis.

Step 1: Put data into correct format. The first thing I needed to do was manipulate the data into an appropriate format for analysis.  I converted the shapefiles into a csv format in R.

Step 2: Subset data The dataframe I was working in contained 652 GPS tracks that spanned from July 15 – September 8. Thus, I needed to take a subset of those tracks to simplify the initial analysis and enable me to more easily test out my code. I chose to subset five tracks that were collected on July 19, 2017.

Step 3: Set up temporal color ramp parameters and palette In order for me to make temporal comparisons between each of the GPS tracks, I needed to standardize the color ramp so each GPS point was given the same color code depending on their date stamp. To do this, I calculated the maximum and minimum time value for all five tracks combined.  These max/min values gave me the temporal parameters for the color ramp.

After I defined the values for the color ramp, I created a color palette that could be applied to each of the tracks. I coded and defined this palette in R.

Step 4: Pull in a satellite map image layer for the graph To provide more context and meaning to the plotted GPS tracks, I thought it would be helpful to add a visual of the location where the tracks were collected. To do this, I downloaded the ‘ggmap’ package in R which allowed me to plug in the coordinates of the GPS tracks and extract a map image layer from Google Earth.

Step 5: Plot the GPS tracks onto the graph I used the ‘ggplot2’ package to plot the GPS points onto the XY coordinate graph. I applied the satellite imagery as a background layer and the color palette that I defined in Step 3. I produced five graphs (see results section).

Bonus approach: After successfully plotting the GPS tracks, I was curious to find out if there were more interactive ways to visualize a recreationists’ movement through time and space. I discovered the ‘leaflet’ package that allows a person to plot data (from both raster and vector data structures) and then zoom in and out, click on features, and essentially interact more dynamically with the results. I was eager to explore this package using my GPS data. After familiarizing myself with the syntax and objects for this package, I was able to successfully plot the GPS points and color code the tracks based on their timestamp (see results sections).

Brief description of results you obtained.

The results I obtained were five graphs that represented the movement of five recreationists through time at String and Leigh Lake in Grand Teton National Park. These results successfully demonstrate the first step necessary for most data analysis: visualizing the data to identify patterns and inform the next steps. Among the five tracks I selected, there was variability in the amount time spent in the area, the locations traveled, and the time for recreation. I intentionally selected one track that represented a water-based recreation user to visualize how their movement compared to those on land.

I was also successful in generating plots that allowed me to zoom-in and out of the points. By doing this, I was able to recognize more detail in the recreation user’s movement. Further, this result allowed me to clearly see where the GPS points were stacked up or close together, i.e. stationary, or slowed movement; or where the person was moving at a higher speed, i.e. points more spread out, evenly spaced.  I was unable to embed the html document into WordPress but am currently working on a method to display these plots. For now, here are a few screenshots that hopefully illustrates the dynamism of this type of plot.

From these results I intend to dive into the next phase of analysis to better understand the behaviors and underlying processes that cause and influence human movement in recreation settings. These processes could be temporal (are there certain times of day or times in the season that influence the movement of people?), environmental (how does the landscape influence the behavior and movement of a person?), social (does group size influence how people move and recreate?) etc. Before doing that, my goal is to analyze some behavioral characteristics within each person’s track. These characteristics include the individual’s step length at one-minute time intervals, and the person’s turning angles at one-minute time intervals. Stay tuned for that tutorial..

Critique of the method – what was useful, what was not?

What was useful: Once I learned the code and syntax to build these graphical representations of a human’s movement through time, I was very pleased with the results. The ggplot package has great functionality and allows me to represent the data in a number of ways. I also appreciated the ability to add a basemap to the graph using ggmap. Because I was new to the software and syntax, the bulk of the work involved building the code.

If people are interested in understanding how I built my code, I generated a text file that annotates the code and steps I took. Click here for the Exercise1_Code

Some criticisms:

a. Limitations in the zoom function for the satellite image —  Adding the satellite image to the graph provided additional meaning to the results. However, the zoom feature was clunky. For example, a zoom of a value of 5 compared to a zoom of a value of 6 dramatically changed the scale of the image. I’m sure there are ways to work around this, but I wasn’t able to make it work for this exercise.

b. Interpreting time as an integer – In order to denote color to the gps points based on a date stamp, I needed to convert the value of the date stamp to an integer in R. For a non-academic viewing the graphs, he/she/they may be able to understand overall changes in movement through time by simply looking at the variation in color, but they wouldn’t be able to interpret the integer values on the color ramp legend. In other words, by changing the date stamp to an integer, it’s hard to conceptually place the data points within a real point in time. I chose to work around this issue by including a start time and end time to each graph, but this was a cumbersome, crude approach.

c.The interactive leaflet map only works with an internet connection. Also, this course’s WordPress site won’t let me embed the image into the blog. The leaflet map was a neat, bonus approach for visualizing the data. However, it would only be useful in situations where there is an internet connection and computer monitor. Therefore, this tool is best used for power-point presentations, websites, or web-tutorials. I was frustrated that I couldn’t embed the html file into the Word Press blog, so you will have to simply view a screenshot of the plots. I believe this inability to embed the html is a function of the settings for the OSU blogs.