[Talk-us] osm-makeroads: a tool to cleanup GPS traces and create ways

Chris Lawrence lordsutch at gmail.com
Thu Sep 27 03:22:25 BST 2012

I've been working on this for a few months off and on, but now it's
refined enough that I at least feel comfortable making a brief
announcement.  It's a bit of code I've named "osm-makeroads";
basically, it's a semi-automated framework for downloading all the GPS
points/traces in a bounding box and using some algorithmic magic to
find traces and points that seem to follow the same route and then
average them using a statistical technique called principal curves
analysis.  I can't claim the credit for inventing all this; the "meat"
is from an academic paper presented at a conference about 5 years ago:

Chris Brunsdon, 2007, "Path Estimation from GPS Tracks," Proceedings
of the 9th International Conference on GeoComputation, National Centre
for Geocomputation, National University of Ireland, Maynooth, Eire.

The only real complication is sorting out all the overlapping traces,
which is what the bulk of the code does before handing each "group" of
similar traces off to the principal curves algorithm.  The code works
best with un-thinned, trackable traces but it'll cope with thinned
stuff too; unordered points will also be added to help the fits.
Obviously the benefits kick in once 2 or more distinct traces are
available of the same route.

I've used it quite a bit for remapping (I-77 in NC and SC, I-69 in IN
are among the earlier examples) and new mapping (such as the new GA
243 bypass in Gordon, GA, just opened yesterday) alike.  It's probably
not perfectly robust yet but I'd imagine it should help people who are
mapping new areas without imagery, or where there are lots of traces
but incomplete local maps.

The code is on github at https://github.com/lordsutch/osm-makeroads.
It requires R, gpsbabel, and a few R packages (all are on CRAN, some
are packaged for Debian, some aren't).  So far it's only tested in
Linux but the code should run on OS X as-is; might need a few tweaks
to the system call code to run on Windows.

Chris Lawrence <lordsutch at gmail.com>

More information about the Talk-us mailing list