Map Matching & Weight Completion service - Java (Springboot) & Python(Flask)

Overview

Map Matching & Weight Completion service - Java (Springboot) & Python(Flask)

Authors

  • Adil Cemalovic
  • Christian Damsgaard
  • Magnus Lund
  • Martin Lønne
  • Simon Holst
  • Søren Hjorth Boelskifte

MapMatching - Java Springboot

A GraphHopper based map matching service for the aSTEP platform.

The service makes use of the open source GraphHopper routing libraries:

The project is written in Java and use the Spring Boot web framework.

About the service

The map matching is perfomed based on map data from Open Street Map.

NB! Currently, only trips in the Chinese city Chengdu can be map matched. If you wish to map match another area, fork the project and import a new area as an OSM-file by using GraphHopper's methods.

Integration with aSTEP

This service is implemented as a REST API and can be used freely by all current and future services on the aSTEP platform.

Multiple map matching services already exists on aSTEP. However, this service offers more data as described in the section How to use.

The service has been made in collaboration with another semester group, Group SW505E20, whose service calls the API. Group SW505 have set up a GUI and database in order to make the map matching functionality in this service available on the aSTEP platform:

How to use

The service exposes the endpoint /mapmatch which accepts a POST request containing raw GPS points and returns the generated map matched points combined with other data that may be useful. Input and output data are both in JSON format.

Expected input

A list of one or more trips containing a list of one or more raw GPS points. Every GPS point must include a latitude, longitude and timestamp. The format of the expected input can be seen here:

[
  {
    "rawPoints": [
      {
        "latitude": 30.62377,
        "longitude": 104.02045,
        "timestamp": "2020-10-21T11:07:41Z"
      },
      {
        "latitude": 30.62665,
        "longitude": 104.02243,
        "timestamp": "2020-10-21T11:08:43Z"
      },
      {
            ......
            ......
      }
    ]
  },
  {
    "rawPoints": [
      {
            ......
            ......
      }
    ]
  }
]

Output

A list of one or more routes containing a list of edges.

An edge corresponds to a segment consisting of a start and end OSM node in the OSM map, where each node reflects a road intersection. Furthermore, an edge contains a distance, which reflects the length of the edge in meters. It also contains information about the average speed traveled on the edge in meters per second. Finally, each edge belongs to an OSM way, which is represented by a OSM way ID.

A route also has a list of matched points, which is a list of points with a latitude and longitude that are snapped to the edge. Finally, a route also has a total distance in meters, as well as the average speed traveled on the whole route. The format of the output can be seen here:

[
    {
      "edges": [
          {
              "osmWayId": 345684193,
              "startNode": {
                  "osmNodeId": 4972899580,
                  "timestamp": "2020-12-14T10:43:32.733+00:00",
                  "latitude": 30.633103600884308,
                  "longitude": 104.04822928566253
              },
              "endNode": {
                  "osmNodeId": 4972899582,
                  "timestamp": "2020-12-14T10:43:34.303+00:00",
                  "latitude": 30.632922924300797,
                  "longitude": 104.04861261804281
              },
              "distance": 41.818,
              "averageSpeed": 26.62481282559887
          },
          {
            ...
          },
          ...
      ],
      "matchedPoints": [
          {
              "latitude": 30.6330068834206,
              "longitude": 104.04843448621955
          },
          {
            ...
          },
          ...
      ],
      "distance": 622.9006982605781,
      "averageSpeed": 15.192699957575076
    }
]

Please note that data is not saved in this service. The client is responsible for saving the returned result in their own service if necessary.

Running the service locally

Just use Docker! 🐳

A docker file is placed in the root folder of this project. Map your local port to port 5000 of the docker container and call the endpoint at http://localhost:YOURLOCALPORT/mapmath

A number of files containing valid, as well as invalid (for testing purposes), input in JSON are placed in the /files folder and can be used to test the service.



Weight Completion

A Weight Completion service for the aSTEP platform - written in Python / Flask.

The service uses machine learning to fill out missing weights in a road network, for a specified time interval. At the moment, the Weight Completion Service can only do weight completion in the Chinese city, Chengdu.

The graph completion algorithm used in the service is based on the Github repository GraphCompletion, created by Jilin Hu, Chenjuan Guo, Bin Yang and Christian S. Jensen. The algorithm was created as a part of the scientific paper "Stochastic Weight Completion for Road Networks Using Graph Convolutional Networks", which can be found here.

The Flask framework has been used as the web framework in this project.

How to use

Please select a date from the form in the menu. After selecting a date, a specific time interval can be selected. A road network with incomplete weights can be visualized on the map by leaving the checkbox unchecked. If checked, a road network with completed weights will be shown. Two tabs are then presented. The first tab will allow the user to inspect the edges on a map, and the other will show the weights for all edges in a table.

Running the service locally

A requirements-file has been provided in order to set up the correct dependencies. As the code uses old versions of several libraries, please ensure that these versions are correct. If you have trouble installing the requirements file, take a look on the trouble shooting comments in the requirements file.

Furtermore, a docker file has been provided if you wish to run the service inside docker. A docker file is placed in the root folder of this project. Map your local port to port 5000 of the docker container and call the endpoint at http://localhost:YOURLOCALPORT/mapmath

You might also like...
Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application.

Flask-Bcrypt Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application. Due to the recent increased prevelance of

Flask-Starter is a boilerplate starter template designed to help you quickstart your Flask web application development.
Flask-Starter is a boilerplate starter template designed to help you quickstart your Flask web application development.

Flask-Starter Flask-Starter is a boilerplate starter template designed to help you quickstart your Flask web application development. It has all the r

Brandnew-flask is a CLI tool used to generate a powerful and mordern flask-app that supports the production environment.

Brandnew-flask is still in the initial stage and needs to be updated and improved continuously. Everyone is welcome to maintain and improve this CLI.

Flask Project Template A full feature Flask project template.

Flask Project Template A full feature Flask project template. See also Python-Project-Template for a lean, low dependency Python app. HOW TO USE THIS

A Fast API style support for Flask. Gives you MyPy types with the flexibility of flask
A Fast API style support for Flask. Gives you MyPy types with the flexibility of flask

Flask-Fastx Flask-Fastx is a Fast API style support for Flask. It Gives you MyPy types with the flexibility of flask. Compatibility Flask-Fastx requir

Flask-app scaffold, generate flask restful backend

Flask-app scaffold, generate flask restful backend

Flask pre-setup architecture. This can be used in any flask project for a faster and better project code structure.

Flask pre-setup architecture. This can be used in any flask project for a faster and better project code structure. All the required libraries are already installed easily to use in any big project.

Pf-flask-rest-com - Flask REST API Common Implementation by Problem Fighter Library

In the name of God, the Most Gracious, the Most Merciful. PF-Flask-Rest-Com Docu

Open-source Flask Sample built on top of flask-dance library
Open-source Flask Sample built on top of flask-dance library

Open-source Flask Sample built on top of flask-dance library. The project implements the social login for Github and Twitter - Originally coded by TestDriven.IO.

Owner
999
null
A service made with Flask and Python to help you find the weather of your favorite cities.

Weather-App A service made with Flask and Python to help you find the weather of your favorite cities. Features Backend using Flask and Jinja Weather

Cauã Rinaldi 1 Nov 17, 2022
Python Flask API service, backed by DynamoDB, running on AWS Lambda using the traditional Serverless Framework.

Serverless Framework Python Flask API service backed by DynamoDB on AWS Python Flask API service, backed by DynamoDB, running on AWS Lambda using the

Andreu Jové 0 Apr 17, 2022
A web application made with Flask that works with a weather service API to get the current weather from all over the world.

Weather App A web application made with Flask that works with a weather service API to get the current weather from all over the world. Uses data from

Christian Jairo Sarmiento 19 Dec 2, 2022
Are-You-OK is a Flask-based, responsive Web App to monitor whether the Internet Service you care about is still working.

Are-You-OK Are-You-OK is a Flask-based, responsive Web App to monitor whether the Internet Service you care about is still working. Demo-Preview Get S

Tim Qiu 1 Oct 28, 2021
A multi-container docker application. Implemented and dockerized a web-based service leveraging Flask

Flask-based-web-service-with-Docker-compose A multi-container docker application. Implemented and dockerized a web-based service leveraging Flask. Des

Jayshree Rathi 1 Jan 15, 2022
flask-reactize is a boostrap to serve any React JS application via a Python back-end, using Flask as web framework.

flask-reactize Purpose Developing a ReactJS application requires to use nodejs as back end server. What if you want to consume external APIs: how are

Julien Chomarat 4 Jan 11, 2022
Flask-Discord-Bot-Dashboard - A simple discord Bot dashboard created in Flask Python

Flask-Discord-Bot-Dashboard A simple discord Bot dashboard created in Flask Pyth

Ethan 8 Dec 22, 2022
Flask Sitemapper is a small Python 3 package that generates XML sitemaps for Flask applications.

Flask Sitemapper Flask Sitemapper is a small Python 3 package that generates XML sitemaps for Flask applications. This allows you to create a nice and

null 6 Jan 6, 2023
Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application.

Flask-Bcrypt Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application. Due to the recent increased prevelance of

Max Countryman 310 Dec 14, 2022
Flask-Rebar combines flask, marshmallow, and swagger for robust REST services.

Flask-Rebar Flask-Rebar combines flask, marshmallow, and swagger for robust REST services. Features Request and Response Validation - Flask-Rebar reli

PlanGrid 223 Dec 19, 2022