Geo Tracking Spring 2011 Betsy
Project Page for CSC220, Fall 2010
- 1 MY TRACKS -- The Android alternative to Walkmeter
- 2 USING R TO MAKE HEATMAPS
- 3 OTHER VISUALIZATIONS
- 3.1 Dots & Trails
- 3.2 Heat & Density Maps
- 3.3 Other
- 4 WEBSITE
MY TRACKS -- The Android alternative to Walkmeter
Introduction to My Tracks - slightly out of date (2009) but still accurate.
My Tracks Homepage: http://mytracks.appspot.com/
USING R TO MAKE HEATMAPS
R and Visualizations
Using R I explored three different ways of visualizing "hotspots" which depict the highest density traffic on the map. My final R script generates four different images that are plotted together in a grid for easy comparison.
We chose to use Open Street Maps instead of Google Maps because it has the most up to date map online that shows recently built buildings, street changes and foot paths. It also has outlines of the buildings at Smith which may be useful in interpreting the traces.
Example R code:
hot_map <- ggplot() + geom_tile(aes(x = lon, y = lat, fill = fill), data = OSMsmith) + geom_tile(aes(x = lon, y = lat, fill = density_s, alpha = density_zeroone), data = kde_df) + scale_x_continuous('Longitude', limits = lon_range) + scale_y_continuous('Latitude', limits = lat_range) + scale_alpha(to = c(0, .9)) + scale_fill_identity() + coord_equal() + theme_nothing()
Before learning how to make heatmaps, we were able to show density with just a plot of the traces generated by the gps devices that we used. Each point is enlarged and made semi-transparent so that points that are close together will overlap and appear darker. This is the simplest way to show density of points on a map.
Example R code:
points_plot <- ggplot() + geom_tile(aes(x = lon, y = lat, fill = fill), data = OSMsmith) + geom_point(aes(x=X,y=Y), colour="blue", size=4, alpha=1/4, data=Path) + scale_x_continuous('Longitude', limits = lon_range) + scale_y_continuous('Latitude', limits = lat_range) + scale_alpha(to = c(0, .9)) + scale_fill_identity() + coord_equal()+ theme_nothing()
The final type of plot we made was a contour plot. This shows density (the red area being the density) as if it were hight on a topographical map. Thus the contours are like cross-sections of a mountain where the top of the mountain is the spot with the higest density traffic.
Example R code:
contour_plot <- ggplot() + geom_tile(aes(x = lon, y = lat, fill = fill), data = OSMsmith) + geom_density2d(aes(x=X,y=Y,colour=..level..), size=2, alpha =.7, data=Path) + scale_alpha(to = c(0, .9)) + scale_fill_identity() + coord_equal()+ theme_nothing()
My two main resources for this portion of the project were:
David Kahle's project on visualizing crime density in downtown Houston. [Crime in Downtown Houston, Texas ]
Dave Allen's Presentation on creating contour and ‘heat map’ graphs to display PITCHf/x data
R and php
"Two projects use PHP to provide a web interface to R. R_PHP_Online by Steve Chen (though it is unclear if this project is still active) is somewhat similar to the above Rcgi and Rweb. R-php is actively developed by Alfredo Pontillo and Angelo Mineo and provides both a web interface to R and a set of pre-specified analyses that need no R code input."
- R_PHP_Online (doesn't look active)
However, I found the most useful resources were sites that provided examples of R and php working side by side.
Ultimately, we want the images produced by the R program to be displayed on the project webpage. Using what I had seen in the examples, I made a very simple php script that executes the R script and displays the output. This is very simple, as long as R is installed on the computer, the proper packages have already been installed. The only major problem is that R can take over 5 minutes to generate an image, depending on how many pixels you want the resulting image to be. This is because we have a solid colored background (the map of smith). If just the heat spots/contour plot/etc could be generated by R and then superimposed onto the map of smith another way, it might save some time.
<html> <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> <PRAGMA NO-CACHE> <title>Heatmap</title> <body> <div> <?php // execute R script HeatMapOutput.R from shell // this will save a plot at smithheatmap.png to the filesystem shell_exec('R --vanilla < HeatMapOutput.R'); // wait 60 seconds - a quick fix to give R enough time to produce the image sleep(60); $nocache = rand(); echo("<img src='smithheatmap.png?$nocache' />"); ?> </div> </body> </html>
Other unanswered questions include: Can we put a Php tunnel as the URL, allowing us to pass parameters? And how can we pass the parameters to R from the Web page? More information can be found at Data Import/Export in R
R and Java
Another potential goal for the future would be to incorporate R into Processing. R has been used with Java, and even with Processing in the R4P project, but getting it to actually work has proved to be very difficult.
R4P Project here
JRI is a Java/R Interface, which allows to run R inside Java applications as a single thread. It appears as though we could use this in processing ...
Dots & Trails
Circle that follows cursor and leaves a fading trail
A test of 6 different fade/blur methods of trailing particles
Processing demo of Metaballs
Heat & Density Maps
Android activations mapped geographically
Processing Heat Map
Heat Map on Google Maps
Density of Clicks on a Web Page
Grid Heat Maps
- Discussion about making heat maps in R
Shows 12 hour analog clock and 24 digital clock
Open Street Map
Most up to date map of Smith that I have found -- complete with foot paths
We are looking for Web templates where we could find sophisticated sets of pages we can use for doing
- student registration
- selection of parameters
- display of tracks.
- Curious of what companies were claiming to be competators to squarespace I found:
- preation.com - the Eden platform (focused less on blogging)
- businesscatalyst.com (much more business oriented)
Map Styles and Selection of Parameters
Interactive Crime Density Map
(Very few of these links may actually be useful)
- examples of registration forms http://www.smileycat.com/design_elements/registration_forms/