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.
Design goals and tenets
- Extensibility
- Ease of use and getting started
- Interoperability
- Functionality over performance (for now)
Projects built using MEOS
MEOS aims to the base on which more libraries can be built. The following projects are built on top of (or experimenting with) MEOS/PyMEOS:
- mobilitydb-sqlalchemy - The SQLAlchemy bindings for MobilityDB.
- MobilityDB-python - The official python driver for MobilityDB. (WIP pull request)
Usage
Python
Installation
pip install pymeos
Note: libgeos-dev might need to be installed on your system.
Code sample
import datetime
from pymeos import GeomPoint
from pymeos.temporal import TGeomPointInst, TGeomPointSeq
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 = TGeomPointSeq({
TGeomPointInst(GeomPoint(0, 0), datetime_utc(2012, 1, 1, 8, 0)),
TGeomPointInst(GeomPoint(2, 0), datetime_utc(2012, 1, 1, 8, 10)),
TGeomPointInst(GeomPoint(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)
Some more operations over this data:
# Work with individual
>>> trajectory.instants
{POINT (2 0)@2012-01-01T08:10:00+0000, POINT (2 1)@2012-01-01T08:15:00+0000, POINT (0 0)@2012-01-01T08:00:00+0000}
>>> trajectory.startValue
POINT (0 0)
>>> trajectory.endValue
POINT (2 1)
# Extract just the temporal aspect
>>> trajectory.timestamps
{datetime.datetime(2012, 1, 1, 8, 15, tzinfo=datetime.timezone.utc), datetime.datetime(2012, 1, 1, 8, 10, tzinfo=datetime.timezone.utc), datetime.datetime(2012, 1, 1, 8, 0, tzinfo=datetime.timezone.utc)}
Documentation
Docs and API Reference: https://pymeos.readthedocs.io/en/latest/
More detailed usage guide/quickstart: https://pymeos.readthedocs.io/en/latest/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;
}
[2@2012-01-01T00:00:00+0000, 1@2012-01-02T00:00:00+0000, 4@2012-01-03T00:00:00+0000, 3@2012-01-04T00:00:00+0000)
Example
Minimalistic C++ app example: https://github.com/adonmo/meos-cpp-example
Documentation
C++ API Reference: https://adonmo.github.io/meos/
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.
- Instruction on how to build, test and generate documentation can be found in DEVELOPMENT.md
- 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 Distributions
Built Distributions
Hashes for pymeos-0.1-pp36-pypy36_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a267bc8305c4984d9a3cb7dee752a1a2ecd5becbafc9a2b3c4ad27b5740663e2 |
|
MD5 | e99afd8066621c6dbdee54d0e0452d5c |
|
BLAKE2b-256 | af0fc01be0e13b24f37be34bfd3637a7eeedca17275582b6cd457d8e1bc38a66 |
Hashes for pymeos-0.1-pp36-pypy36_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94b079c3a0ab187cc38990d5fe9a9cb4c00ea56901a91f47cdf691578030ce80 |
|
MD5 | 9be437bc92102ec8b309986475f6f0b9 |
|
BLAKE2b-256 | 4bb0a3fcd6e529b75fe6af6b9d971a7f62d68d70f55a3b31372cb4b7676b0140 |
Hashes for pymeos-0.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2a696ffe7b6cd47ac450b7dfb6810e576a353a6be3ac1705acd53623b874406 |
|
MD5 | 47392149ec219d1869c7e9099cab9387 |
|
BLAKE2b-256 | dff3a4966643211e10924eb686db6109119a972f675f86ba166b60803640a25d |
Hashes for pymeos-0.1-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8730406c2e722978b4da7d81c6f55a0354cf6810f8db9e004f4d67e06bfb0fb2 |
|
MD5 | f0887e8aaa48a94807a13115e5429173 |
|
BLAKE2b-256 | 0df248e07f2799e6df0f621b8add3390c1e4d9cd279aa669510e0767f6f41148 |
Hashes for pymeos-0.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ac88f61d5b4f48020f9bd507d9afd7a7bde612652226d84b4d83b5aafe7e085 |
|
MD5 | f70a0fc22da49f3a71d1dfbf83ed8b51 |
|
BLAKE2b-256 | 6b67d5bb9453330cb650b88d0fb04926c618b1340d9e4905d0db1beff7a72151 |
Hashes for pymeos-0.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97e8586fbf43a3b4da3b9ef4d6d71a5a27f96b435cfbc6b9f128b7f214311d83 |
|
MD5 | b4f7302079529bd230ea5e252a6a03b9 |
|
BLAKE2b-256 | 4b66255a83c25d6737603e2bfda0b86387b58baaea7b65b70d4fd19639875b3b |
Hashes for pymeos-0.1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06a618b110172d82cc700535897e5e8545ae083f7e2f824ff54c34780616a269 |
|
MD5 | 55bb822fa305c780dbf6ef970072db90 |
|
BLAKE2b-256 | 373672df9c2c205e870ca868a9d2df39f31a8509e678482818afd86ea22f8a02 |
Hashes for pymeos-0.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d72d9f79c222b9eae454493bc7c5e6c156d914b8a6cdbaa91d7b1daf0a768ea |
|
MD5 | e47d7f5f750194b8a1ecdb0fb8ac603c |
|
BLAKE2b-256 | 68d63c76b2661b8ef02caf22dd6c08550bf7f3a638b8168f23eb175da40a8aa9 |
Hashes for pymeos-0.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 052886562bb21027a2c75b480a359cb47121cac9dbc8379d70fbdc540e61e2b6 |
|
MD5 | c46a4f53466c91e4657def0ef811bf18 |
|
BLAKE2b-256 | e72c0e894ca943b49b8cbd4500c94d5dc9c15efc3037589088570fac94c939ed |
Hashes for pymeos-0.1-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c642ec7da8da22c308d21d0f23025cb775aab78968b0d993ff2b0a74e2a1f98a |
|
MD5 | 314ac33d7ab5ccf5c38edc265bc2e824 |
|
BLAKE2b-256 | 507cbcdda9fc645d1cb14d8225a69e46fa9f5ee7e56e2a1a93772417eec0659d |
Hashes for pymeos-0.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 439d09a2d65a3a45dd7fb856fcfe661260ba8f49267efe09b97c8cbfc1052cfa |
|
MD5 | 602d771bca30174b86f328b5253562c5 |
|
BLAKE2b-256 | def7183209f41a644a92e390d46dace306e6231866dd4ce6a49d9a7cccaab4b2 |
Hashes for pymeos-0.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0ca7d5bb8798d80af5e8839efdf66eaf5b862f63089e24bd16808521e74c808 |
|
MD5 | 749067b766945b7c361aadb7af90c236 |
|
BLAKE2b-256 | 7daaee4cd11ceb3aaaa1a0f616cda20c3b789cf315819d75ef9ec94f2a0b864d |
Hashes for pymeos-0.1-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8872b0d3788c3664f8df8777aec1c81aba4d5ad7f7ddd27d662207dbd9c29f7 |
|
MD5 | d8e19d5b54042abccd87b7e3f894d6a9 |
|
BLAKE2b-256 | df668bf85faf2b45f24d3bc851dccdf7a8d3a3923b1056cc2a77c92d7de2d50a |
Hashes for pymeos-0.1-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 298fa89559ab643c194b6c75bbafad936282f1fbbc535009badd28b78a6dcadc |
|
MD5 | bb4902250c88b3798f6b2ebf43d4199b |
|
BLAKE2b-256 | 01d44d2e91617670e8e79260bf8c75daf83e15843b17cb33695320265ce31836 |