Web app showing stops and departures in your vicinity based on data from rejseplanen.dk (http://labs.rejseplanen.dk/api)
-
You can try it at http://flaskplan.sloppy.zone/
-
To start a local instance on port 5000
make run -
To start a docker container on port 8000
make docker-run(use sudo on linux)
Dockerfile: wrap this app as a docker container usingmod-wsgitravis.yml: configuration for https://travis-ci.org/christoflemke/flaskplan/website/__init__.py: The app...website/static: static resourceswebsite/static/underscore.js: used in fronten codewebsite/static/main.js: frontend JavaScriptwebsite/rejseplanen.py: interface to the public API of rejseplanen.dk (http://labs.rejseplanen.dk/api)website/templates/index.html: the index pagerun.py: starts a local instancecfg/flaskplan.conf: apache configurationtest/test_rejseplanen.py: test parsingtest/test_app.py: test the backend part of the apptest/data/: test datarequirements.txt: python dependenciesflaskplan.wsgi: wsgi entry point for apacheMakefile: make fileflaskplan.json: deployment definition for sloppy.ioLICENSE: Apache License 2.0README.md: this readme
The backend implements two REST service calls. The response format is always JSON. The design goal has been to provide a service that makes the implementation of the frontend as convenient as possible.
This service call will return the closest stop given the coordinates in WGS 84.
Parameters:
- lat: the latitude (example:
56.17118730000001) - lon: the longitude (example:
10.197282399999999)
The response is always a JSON array with one element for each stop.
Response keys:
- lat/lon: the latitude/longitude of the stop
- distance: distance from the current position
- name: the name of the stop
- id: a unique id used in request to the
/departuresservice
Example Response:
[{
'lat': 56.170104,
'distance': '137',
'lng': 10.19837,
'id': '751428000',
'name': 'Aarhus Universitet. Statsbiblioteket. Langelandsg.'
}, {
'lat': 56.170994,
'distance': '184',
'lng': 10.200249,
'id': '751406800',
'name': 'Aarhus Universitet. Statsbiblioteket og Stakladen'
}]
The service call will return the next departures given a stop id.
Parameters:
- id: A stop id from a
/locationcall.
Response keys:
- direction: In which direction does route go.
- name: The name of the route.
- time: The departure time.
Example Response:
[{
'direction': 'Holme Parkvej',
'name': 'Bybus 16',
'time': '18:30'
}, {
'direction': 'Holme Parkvej',
'name': 'Bybus 16',
'time': '19:30'
}]