Skip to content

Commit 636f459

Browse files
MobilityAPI-Python: OGC API – Moving Features server over MobilityDB
A PyMEOS-backed Python implementation of OGC API – Moving Features (OGC 22-003r3) over MobilityDB. The HTTP server exposes collections and moving features with the full read/write lifecycle (GET/POST/PUT/DELETE), the temporal-geometry sequence, the derived temporal-geometry queries (distance, velocity, acceleration), and temporal properties; a bulk-ingest extension appends a GeoJSON/GeoParquet fleet feed as instants. PyMEOS performs the temporal-data conversion (MF-JSON in and out), so the server holds the OGC request/response shaping and the database holds the temporal computation. The repository carries a notebook tutorial over Danish AIS data, unit tests, and the PostgreSQL License. The compiled Go server at MobilityDB/MobilityAPI is the reference (production) implementation.
0 parents  commit 636f459

66 files changed

Lines changed: 494465 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Bug report
3+
about: Report unexpected behaviour, errors, or test failures
4+
title: "[BUG] "
5+
labels: bug
6+
---
7+
8+
## Description
9+
10+
Brief description of the bug.
11+
12+
## Steps to reproduce
13+
14+
1. ...
15+
2. ...
16+
3. ...
17+
18+
## Expected behaviour
19+
20+
What you expected to happen.
21+
22+
## Actual behaviour
23+
24+
What actually happened. Include error messages, stack traces, or response bodies as appropriate.
25+
26+
## Environment
27+
28+
- MobilityAPI version / commit:
29+
- Python version:
30+
- PostgreSQL version:
31+
- MobilityDB version:
32+
- OS:
33+
34+
## Additional context
35+
36+
Anything else that might help — minimal reproducer, related issues, OGC API – Moving Features specification reference if relevant.

.github/ISSUE_TEMPLATE/feature.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Feature request
3+
about: Suggest a new endpoint, OGC-conformance improvement, or backend integration
4+
title: "[FEAT] "
5+
labels: enhancement
6+
---
7+
8+
## Motivation
9+
10+
What problem does this feature solve, or what use case does it enable?
11+
12+
## Proposed change
13+
14+
A clear description of the new endpoint, behaviour, or integration. If it relates to the OGC API – Moving Features standard, link to the relevant section: https://docs.ogc.org/is/22-003r3/22-003r3.html
15+
16+
## Alternatives considered
17+
18+
Other approaches you considered and why this one is preferable.
19+
20+
## Additional context
21+
22+
Related issues, references, or examples from sister projects (PyMEOS, JMEOS, MobilityDB, MobilityDuck).

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Summary
2+
3+
Brief description of what this PR does and why.
4+
5+
## Changes
6+
7+
- ...
8+
9+
## Related issues
10+
11+
Fixes #N / Refs #N
12+
13+
## Testing
14+
15+
How you verified the change. Output of `./run.sh --with-tests` for substantive changes; for documentation-only changes a description of what you read suffices.
16+
17+
## Checklist
18+
19+
- [ ] Tests pass locally
20+
- [ ] `ruff check .` passes
21+
- [ ] Documentation updated where relevant
22+
- [ ] Entries in `AUTHORS.md` / `CITATION.cff` updated if this is a first-time substantial contribution

.github/workflows/python.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Python checks
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
lint:
10+
name: Lint (ruff)
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.11"
17+
- name: Install ruff
18+
run: pip install ruff
19+
- name: Run ruff
20+
run: ruff check . || echo "::warning::ruff found issues — please fix before merging"
21+
continue-on-error: true
22+
23+
python-import:
24+
name: Import smoke test
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-python@v5
29+
with:
30+
python-version: "3.11"
31+
- name: Install dependencies
32+
run: |
33+
pip install --upgrade pip
34+
pip install -r requirements.txt
35+
- name: Verify modules import
36+
run: |
37+
python -c "import server" || true
38+
python -c "import utils"
39+
python -c "from resource.collections import Create, Retrieve"
40+
python -c "from resource.moving_features import Create, Retrieve"
41+
python -c "from resource.temporal_geom_query import distance, velocity, acceleration"
42+
43+
unit-tests:
44+
name: Unit tests (PyMEOS-free)
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: actions/setup-python@v5
49+
with:
50+
python-version: "3.11"
51+
- name: Install test dependencies
52+
run: pip install pytest pyarrow
53+
- name: Run unit tests
54+
run: python -m pytest tests/test_bulk.py -v

.gitignore

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
# C extensions
6+
*.so
7+
poetry.lock
8+
MobilityDB
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/#use-with-ide
110+
.pdm.toml
111+
112+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113+
__pypackages__/
114+
115+
# Celery stuff
116+
celerybeat-schedule
117+
celerybeat.pid
118+
119+
# SageMath parsed files
120+
*.sage.py
121+
122+
# Environments
123+
.env
124+
.venv
125+
env/
126+
venv/
127+
ENV/
128+
env.bak/
129+
venv.bak/
130+
win/
131+
132+
# Spyder project settings
133+
.spyderproject
134+
.spyproject
135+
136+
# Rope project settings
137+
.ropeproject
138+
139+
# mkdocs documentation
140+
/site
141+
142+
# mypy
143+
.mypy_cache/
144+
.dmypy.json
145+
dmypy.json
146+
147+
# Pyre type checker
148+
.pyre/
149+
150+
# pytype static type analyzer
151+
.pytype/
152+
153+
# Cython debug symbols
154+
cython_debug/
155+
156+
# PyCharm
157+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
158+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
159+
# and can be added to the global gitignore or merged into this file. For a more nuclear
160+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
161+
#.idea/
162+
163+
*.zip
164+
*.csv
165+
#developement
166+
notes.md
167+
debug.md
168+
tests/api_logs.json
169+
RTDATA
170+
rest-clients
171+
.vscode
172+
docker-compose.yml
173+
tmp.txt
174+
# database dumps are not tracked
175+
mydb_dump.sql
176+
*.dump

AUTHORS.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Authors
2+
3+
MobilityAPI is the result of contributions from several individuals across two phases. The project's lineage starts with **pg_mfserv** (2024), an OGC API – Moving Features prototype that established the Python-server skeleton and the PyMEOS-based MobilityDB integration pattern. **MobilityAPI** (2025–) extends that foundation into a production-grade implementation with a structured resource layout, comprehensive tests, and OGC conformance.
4+
5+
## Founding phase (2024) — as `pg_mfserv`
6+
7+
Affiliated with [Université libre de Bruxelles (ULB)](https://www.ulb.be/).
8+
9+
- **Maxime Schoemans** ([@mschoema](https://github.com/mschoema)) — initial commit, OGC API – Moving Features endpoint design, project skeleton.
10+
- **Victor Morabito** ([@MrMaxime1er](https://github.com/MrMaxime1er)) — main developer of pg_mfserv: column discovery, request/response handling, exception handling, route refactors, feature endpoints (collections, items, temporal geometry, temporal properties).
11+
12+
The pg_mfserv repository is preserved at [`MobilityDB/pg_mfserv`](https://github.com/MobilityDB/pg_mfserv) in archived form.
13+
14+
## Current phase (2025–) — as `MobilityAPI`
15+
16+
Affiliated with [Université libre de Bruxelles (ULB)](https://www.ulb.be/).
17+
18+
- **Sirine Meraoui** ([@sirimeraoui](https://github.com/sirimeraoui)) — current maintainer; structured resource layout (`resource/` tree); test infrastructure; OGC conformance; HTTP-status-code translation; documentation; demo notebooks; AIS dataset integration.
19+
20+
## Acknowledgements
21+
22+
The project benefits from the broader [MEOS ecosystem](https://libmeos.org/), in particular:
23+
24+
- **[PyMEOS](https://github.com/MobilityDB/PyMEOS)** — the Python binding of MEOS that MobilityAPI consumes today.
25+
- **[MobilityDB](https://github.com/MobilityDB/MobilityDB)** — the PostgreSQL extension providing the SQL surface backing MobilityAPI.
26+
- **[OGC API – Moving Features Standard](https://docs.ogc.org/is/22-003r3/22-003r3.html)** — the standard MobilityAPI implements.

CITATION.cff

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
cff-version: 1.2.0
2+
title: MobilityAPI
3+
type: software
4+
message: "If you use MobilityAPI in academic or technical work, please cite it using the metadata below."
5+
abstract: >-
6+
MobilityAPI is an OGC API – Moving Features Standard reference
7+
implementation for MEOS-stored mobility data. It provides REST
8+
endpoints (GET / POST / PUT / DELETE) over collections of moving
9+
features, suitable for HTTP-driven clients consuming MobilityDB
10+
trajectories.
11+
12+
authors:
13+
- family-names: Meraoui
14+
given-names: Sirine
15+
affiliation: Université libre de Bruxelles (ULB)
16+
17+
repository-code: "https://github.com/MobilityDB/MobilityAPI"
18+
url: "https://libmeos.org/bindings/mobilityapi/"
19+
20+
keywords:
21+
- mobility
22+
- trajectory
23+
- ogc-api
24+
- moving-features
25+
- mobilitydb
26+
- meos
27+
- rest-api
28+
29+
license: PostgreSQL
30+
31+
references:
32+
- type: software
33+
title: pg_mfserv
34+
abstract: >-
35+
Founding OGC API – Moving Features Python server for
36+
MobilityDB. The initial implementation that MobilityAPI
37+
extends.
38+
authors:
39+
- family-names: Schoemans
40+
given-names: Maxime
41+
affiliation: Université libre de Bruxelles (ULB)
42+
- family-names: Morabito
43+
given-names: Victor
44+
affiliation: Université libre de Bruxelles (ULB)
45+
repository-code: "https://github.com/MobilityDB/pg_mfserv"
46+
notes: >-
47+
Predecessor implementation; archived at
48+
MobilityDB/pg_mfserv. MobilityAPI builds on its OGC endpoint
49+
design and PyMEOS integration pattern.

0 commit comments

Comments
 (0)