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

A flask app that turn image into ASCII art

ASCII art A flask app that turn image into ASCII art. This app has been deployed to https://motmaytinh.herokuapp.com Getting Started These instruction

Trần Ngọc Quý 1 Jan 13, 2022
Companion code to my O'Reilly book "Flask Web Development", second edition.

Flasky This repository contains the source code examples for the second edition of my O'Reilly book Flask Web Development. The commits and tags in thi

Miguel Grinberg 8k Dec 27, 2022
Making a simple app using React, Flask and MySQL.

Samys-Cookbook Making a simple app using React and Flask. What This will be a simple site to host my recipes. It will have a react front-end, a flask

Samridh Anand Paatni 1 Jul 07, 2022
Adds GraphQL support to your Flask application.

Flask-GraphQL Adds GraphQL support to your Flask application. Usage Just use the GraphQLView view from flask_graphql from flask import Flask from flas

GraphQL Python 1.3k Jan 03, 2023
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 02, 2022
A weather report application build with Python, Flask, and Geopy.

A weather report application build with Python, Flask, and Geopy. Requirements Python 3

Brandon Wallace 6 May 07, 2022
A web application that consists of a collection of board games

PyBoardGame About This website contains a collection of board games for users to enjoy, as well as various guides for the games. The web app is built

Larry Shi 0 Aug 11, 2021
A Flask app template with integrated SQLAlchemy, authentication, and Bootstrap frontend

Flask-Bootstrap Flask-Bootstrap is an Flask app template for users to clone and customize as desired, as opposed to a Flask extension that you can ins

Eric S. Bullington 204 Dec 26, 2022
Adds SQLAlchemy support to Flask

Flask-SQLAlchemy Flask-SQLAlchemy is an extension for Flask that adds support for SQLAlchemy to your application. It aims to simplify using SQLAlchemy

The Pallets Projects 3.9k Dec 29, 2022
Flaskr: Intro to Flask, Test-Driven Development (TDD), and JavaScript

Flaskr - Intro to Flask, Test-Driven Development, and JavaScript Share on Twitter As many of you know, Flaskr -- a mini-blog-like-app -- is the app th

Michael Herman 2.2k Jan 04, 2023
Source code for backpainfree.org - a Q&A platform similar to StackOverFlow

Source code for backpainfree.org - a Q&A platform similar to StackOverFlow, which is designed specifically for people with back pain problems. Users can ask questions, post answers and comments, vote

Olzhas Arystanov 8 Dec 11, 2022
This is a simple web application using Python Flask and MySQL database.

Simple Web Application This is a simple web application using Python Flask and MySQL database. This is used in the demonstration of development of Ans

Alaaddin Tarhan 1 Nov 16, 2021
This is a small notes web app, with python and flask microframework. Using sqlite3

Python Notes App. This is a small web application maked with flask-python for add notes easily and quickly. Dependencies. You can create a virtual env

Eduard 1 Dec 26, 2021
flask extension for integration with the awesome pydantic package

Flask-Pydantic Flask extension for integration of the awesome pydantic package with Flask. Installation python3 -m pip install Flask-Pydantic Basics U

248 Dec 26, 2022
HTTP security headers for Flask

Talisman: HTTP security headers for Flask Talisman is a small Flask extension that handles setting HTTP headers that can help protect against a few co

Google Cloud Platform 853 Dec 19, 2022
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

Tactful.ai 18 Nov 26, 2022
REST API built using flask framework that used for managing bookmarks by individual users.

Bookmarks REST API REST API built using flask framework that used for managing bookmarks by individual users. API Consumers Note This app is built usi

Venkatesh Tantravahi 1 Dec 27, 2021
a flask profiler which watches endpoint calls and tries to make some analysis.

Flask-profiler version: 1.8 Flask-profiler measures endpoints defined in your flask application; and provides you fine-grained report through a web in

Mustafa Atik 718 Dec 20, 2022
SQLAlchemy database migrations for Flask applications using Alembic

Flask-Migrate Flask-Migrate is an extension that handles SQLAlchemy database migrations for Flask applications using Alembic. The database operations

Miguel Grinberg 2.2k Dec 28, 2022
A simple FastAPI web service + Vue.js based UI over a rclip-style clip embedding database.

Explore CLIP Embeddings in a rclip database A simple FastAPI web service + Vue.js based UI over a rclip-style clip embedding database. A live demo of

18 Oct 15, 2022