Giter Site home page Giter Site logo

wenjian-id / map-matching Goto Github PK

View Code? Open in Web Editor NEW

This project forked from graphhopper/map-matching

0.0 1.0 0.0 8.94 MB

Map Matching based on GraphHopper

Home Page: https://www.graphhopper.com/open-source/

License: Apache License 2.0

HTML 0.80% JavaScript 13.49% CSS 4.88% Java 80.83%

map-matching's Introduction

Map Matching based on GraphHopper

Build Status

Snaps GPX traces to the road using the GraphHopper routing engine.

Read more about the map matching problem at Wikipedia.

Currently this project is under development but produces already good results for various use cases. Let us know how it works for you!

See the demo in action (black is GPS track, green is matched result):

map-matching-example

License

Apache License 2.0

Discussion

Our web forum is here.

Usage

Java 8 and Maven >=3.3 are required. For the 'core' module Java 7 is sufficient.

Build:

mvn package -DskipTests

Then you need to import an OSM map for the area you want to do map-matching on, e.g. the provided sample data:

java -jar matching-web/target/graphhopper-map-matching-web-0.13-SNAPSHOT.jar import map-data/leipzig_germany.osm.pbf

OpenStreetMap data in pbf or xml format are available from here.

The optional parameter --vehicle defines the routing profile like car, bike, motorcycle or foot. You can also provide a comma separated list. For all supported values see the variables in the FlagEncoderFactory of GraphHopper.

Before re-importing, you need to delete the graph-cache directory, which is created by the import.

Now you can match GPX traces against the map:

java -jar matching-web/target/graphhopper-map-matching-web-0.13-SNAPSHOT.jar match matching-core/src/test/resources/*.gpx

Web app

Start via:

java -jar matching-web/target/graphhopper-map-matching-web-0.13-SNAPSHOT.jar server config.yml

Access the simple UI via localhost:8989.

You can post GPX files and get back snapped results as GPX or as compatible GraphHopper JSON. An example curl request is:

curl -XPOST -H "Content-Type: application/gpx+xml" -d @matching-core/src/test/resources/test1.gpx "localhost:8989/match?vehicle=car&type=json"

Tools

Determine the bounding box of one or more GPX files:

java -jar matching-web/target/graphhopper-map-matching-web-0.13-SNAPSHOT.jar getbounds matching-core/src/test/resources/*.gpx

Java usage

Have a look at MapMatchingResource.java to see how the web service is implemented on top of library functions to get an idea how to use map matching in your own project.

Use this Maven dependency:

<dependency>
    <groupId>com.graphhopper</groupId>
    <artifactId>graphhopper-map-matching-core</artifactId>
    <version>0.13-SNAPSHOT</version>
</dependency>

Note

Note that the edge and node IDs from GraphHopper will change for different PBF files, like when updating the OSM data.

About

The map matching algorithm mainly follows the approach described in

Newson, Paul, and John Krumm. "Hidden Markov map matching through noise and sparseness." Proceedings of the 17th ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems. ACM, 2009.

This algorithm works as follows. For each input GPS position, a number of map matching candidates within a certain radius around the GPS position is computed. The Viterbi algorithm as provided by the hmm-lib is then used to compute the most likely sequence of map matching candidates. Thereby, the distances between GPS positions and map matching candidates as well as the routing distances between consecutive map matching candidates are taken into account. The GraphHopper routing engine is used to find candidates and to compute routing distances.

Before GraphHopper 0.8, this faster but more heuristic approach was used.

map-matching's People

Contributors

karussell avatar michaz avatar stefanholder avatar nakaner avatar kodonnell avatar 1kastner avatar devemux86 avatar chucre avatar hbruch avatar tyrasd avatar tochev avatar ustroetz avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.