Skip to content


Subversion checkout URL

You can clone with
Download ZIP
R code to "average" GPS traces from OpenStreetMap to derive usable GPX tracks for roadways
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


R code to "average" GPS traces from OpenStreetMap to derive usable GPX tracks for roadways.


  • R (core)
  • R packages: princurve, rgdal, maptools, geosphere, rgeos (all on CRAN)
  • gpsbabel
  • Also: libgdal and gfortran are required by some of the dependencies above.

To get started using Debian unstable (or presumably Ubuntu w/universe):

apt-get install libgeos-dev r-cran-maptools gpsbabel libgdal-dev gfortran libgdal-dev

R -e "install.packages('princurve', 'geosphere', 'rgeos', 'rgdal', dependencies=TRUE)"

makeroads.R and process.R are lightly commented. Place them in the same directory (and cd there), edit process.R to your liking, then use:

R -f process.R

You'll get a bunch of GPX files named 'roadway-*.gpx', one per identified track, along with Rplots.pdf containing a visual representation of each estimated track along with the tracks that were used to construct it.

Recent Changes

  • This version uses rgeos to ridiculously improve the time taken to match the tracks. (Data matching now takes an order of minutes versus hours in previous versions.)


  • Use local principal curves (R LPCM package).
  • Take advantage of parallelism (investigate R multicore?).
  • Memory usage improvements.


Something went wrong with that request. Please try again.