Python bindings to MEOS
Project description
MEOS (Mobility Engine, Open Source) is a C++ library which makes it easy to work with temporal and spatio-temporal data. It is based on MobilityDB's data types and functions. MEOS's code is heavily inspired from a similar library called GEOS - hence the name. This repository also includes PyMEOS - python bindings to MEOS using pybind11.
⚠️ Currently this library is an early, experimental stage - breaking changes might occur as it evolves.
Usage
Python
Installation
$ pip install git+https://github.com/adonmo/meos
Note: This assumes libgeos-dev is already installed on your system.
Code sample
import datetime
from pymeos import Geometry
from pymeos.temporal import TInstantGeom, TSequenceGeom
def datetime_utc(year, month, day, hour=0, minute=0, second=0):
return datetime.datetime(year, month, day, hour, minute, second, tzinfo=datetime.timezone.utc)
# Example creation of trajectory (temporal sequence of geometries)
trajectory = TSequenceGeom({
TInstantGeom(Geometry(0, 0), datetime_utc(2012, 1, 1, 8, 0)),
TInstantGeom(Geometry(2, 0), datetime_utc(2012, 1, 1, 8, 10)),
TInstantGeom(Geometry(2, 1), datetime_utc(2012, 1, 1, 8, 15)),
})
print(trajectory)
[POINT (0 0)@2012-01-01T08:00:00+0000, POINT (2 0)@2012-01-01T08:10:00+0000, POINT (2 1)@2012-01-01T08:15:00+0000)
Documentation
Docs and API Reference: https://pymeos.netlify.app
More detailed usage guide/quickstart: https://pymeos.netlify.app/quickstart.html
C++
#include <iostream>
#include <meos/types/temporal/TSequence.hpp>
#include "time_utils.cpp"
using namespace std;
int main() {
set<TInstant<int>> instants = {
TInstant<int>(2, unix_time_point(2012, 1, 1)),
TInstant<int>(1, unix_time_point(2012, 1, 2)),
TInstant<int>(4, unix_time_point(2012, 1, 3)),
TInstant<int>(3, unix_time_point(2012, 1, 4)),
};
TSequence<int> tseq(instants);
cout << tseq << endl;
return 0;
}
Example
Minimalistic C++ app example: https://github.com/adonmo/meos-cpp-example
Documentation
C++ API Reference: https://meos.netlify.app
Development
MEOS uses the CMake and setuptools for the build system, and Catch2 and pytest for tests.
Building
$ cmake -B build -S .
$ cmake --build build
Testing
C++
$ cmake -B build/test -S test -DCMAKE_BUILD_TYPE=Release
$ cmake --build build/test --config Release
$ ./build/test/libmeos-tests
Python
$ pip install .
$ pip install -r tests/python/requirements.txt
$ pytest
Building docs
C++ (Doxygen)
$ cmake -B build/docs -S documentation
$ cmake --build build/docs
$ cmake --build build/docs --target cppdocs
You can then proceed to host the docs locally, for example on http://0.0.0.0:8000/
$ python -m http.server --directory build/docs/doxygen/html
Python (Sphinx)
$ pip install .[docs]
$ cmake -B build/docs -S documentation
$ cmake --build build/docs
$ cmake --build build/docs --target pydocs
You can then proceed to host the docs locally, for example on http://0.0.0.0:8000/
$ python -m http.server --directory documentation/python/_build/html
Contributing
Issues and pull requests are welcome.
- For proposing new features/improvements or reporting bugs, create an issue.
- Check open issues for viewing existing ideas, verify if it is already proposed/being worked upon.
- When implementing new features make sure to add relevant tests and documentation before sending pull requests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pymeos-0.0.8-pp36-pypy36_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea329907a883359cc4222416575a74ba0b05a2fbe8672a2c5905ad27adc4bbc1 |
|
MD5 | 833be5476d3d04a24a3b0637a6602506 |
|
BLAKE2b-256 | fac75b43f15c57e04debfcc6c93a1e2cb177c338af30ceca40a5985fcf01b348 |
Hashes for pymeos-0.0.8-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 035db0ba7268792726608bb4c5a98efe28bd8f354d9705f2e0164a4aa6f60671 |
|
MD5 | b6898c7d5f48e4b00bd37451e697a5f5 |
|
BLAKE2b-256 | de6f6443a3c7879131839dd47f68c3888a4d73698818344fb56e8802d26e6da0 |
Hashes for pymeos-0.0.8-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fb954c1706cf5de92fb453c93dd95f19926f87c3475cf11b97a3090d9885c94 |
|
MD5 | 87d431a04221450a88b52aa9cd0d9e32 |
|
BLAKE2b-256 | 839d68f76eb34ab68cacc5e59e86cd37373c617eb99a858bcc16f035cfc02649 |
Hashes for pymeos-0.0.8-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eff27f08cdb6401db98f0f1cf2ac95f28e328d4c7eb83c024123b07efadcb6e5 |
|
MD5 | 18dc5fc6218765c31ad0495a8c0d45d9 |
|
BLAKE2b-256 | 86ff2426d28dee77c5a3fe8c5f8c0b523005593b7bf2c9acc66612f9490a3f02 |
Hashes for pymeos-0.0.8-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5e08ec6264772c414b81103cebf6ee689bc03919d56fca6b01b3afbb3c0130a |
|
MD5 | cd5a033cce3273eb682e6c844ffc62ad |
|
BLAKE2b-256 | bb78eb5cd37ca38f658a60947ca0a87adb2bce9c7c4564b94924f63e7d48d930 |