/mapmatcher

A simple map matching library using the Hidden-Markov Model Map Matching algorithm (HMM Map Matching) from Paul Newson and John Krumm, "Hidden Markov Map Matching Through Noise and Sparseness", 17th ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems (ACM SIGSPATIAL GIS 2009), November 4-6, Seattle, WA, pp. 336-343. It is designed to be used from R and uses the GeOxygene implementation of the algorithm.

Primary LanguageJava

Build Status

Overview

A simple map matching library using the Hidden-Markov Model Map Matching algorithm (HMM Map Matching) from Paul Newson and John Krumm, "Hidden Markov Map Matching Through Noise and Sparseness", 17th ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems (ACM SIGSPATIAL GIS 2009), November 4-6, Seattle, WA, pp. 336-343. (PDF, slides, shared data).

It is designed to be used from R and uses the GeOxygene implementation of the algorithm.

# Usage

Installation

You will need to have git and maven installed to proceed.

git clone git@github.com:julienperret/mapmatcher.git
cd mapmatcher
mvn install

If that fails, it might be because of insecure SSL certificate. Try the following:

mvn install -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true

this should produce a file named mapmatcher-0.0.1-SNAPSHOT-jar-with-dependencies.jar in the target directory. You can then include this library in R by placing the library in the classpath.

export CLASSPATH=./target/mapmatcher-0.0.1-SNAPSHOT-jar-with-dependencies.jar

Good, now you can use the library from R. In order to do that, let's create a simple function:

matchHikingTrail<-function(
  gpsFile,
  networkFile,
  outFile=tempfile(),
  sigmaZ=10.0,
  selection=50.0,
  beta=6.0,
  distanceLimit=2000.0)
{
  command=paste("java",
                "mapmatcher.MatchHikingTrail",
                gpsFile,
                networkFile,
                outFile,
                sigmaZ=10.0,
                selection=50.0,
                beta=6.0,
                distanceLimit)
  system(command)
  read.table(outFile,header=TRUE)
}

An example call of the function with existing shapefiles:

matchHikingTrail("/my/existing/gps_file.shp","/my/existing/roadnetwork_file.shp","/output/matched_gps_file.csv")