Skip to content

Latest commit

 

History

History
40 lines (24 loc) · 1.88 KB

README.md

File metadata and controls

40 lines (24 loc) · 1.88 KB

GPS Heatmap Animation

Make vector heatmap

Vector heatmaps created with R and script from FlowingData.

Install R and dependencies

  1. Download and Install R
  2. Launch R in the command line with R.
  3. In R, run install.packages("plotKML") to install plotKML (a library used by the script) and all its dependencies.
  4. R will attempt to use XQuartz to ask you to choose a mirror to get packages from. If you don't have it, go download, install and repeat step three.

Convert multiple GPX files to one SVG heatmap

  1. cd to the directory with maps.R and your source .gpx files.
  2. Run R CMD BATCH maps.R. This will generate a PDF called Rplots.pdf.
  3. The process to make this PDF an SVG is manual (I'd like to try and automate it). But for the moment you'll need to open the PDF in Illustrator and save as an SVG.

Animate SVG

Convert SVG polylines to paths

Illustrator spits out each GPS line as SVG <polyline>s. To animate them we need them to be <path>s.

To convert the polylines to paths you essentially need to replace all instances of <polyline with <path and points=" with d="M. I've documented this process a bit further in this Gist.

You could simply do find and replace but I've written a small Ruby script to automate this.

  1. cd to directory containing Rplots.svg and polyline-to-path.rb.
  2. run ruby polyline-to-path.rb

Start localhost server and check it out

  1. cd to directory containing index.html and start a localhost server with python -m SimpleHTTPServer 8000.
  2. Visit http://localhost:8000