Skip to main content

Python bindings to MEOS

Project description

Tests Status Codacy Badge MIT License

MEOS Logo

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.

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. Right now work is underway for the following to be rewritten on top of MEOS/PyMEOS:

Usage

Python

Installation

pip install pymeos

Note: libgeos-dev might need to be 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)

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.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;
}
[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)

Example

Minimalistic C++ app example: https://github.com/adonmo/meos-cpp-example

Documentation

C++ API Reference: https://meos.netlify.app

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymeos-0.0.9.tar.gz (42.8 kB view hashes)

Uploaded Source

Built Distributions

pymeos-0.0.9-pp36-pypy36_pp73-manylinux2010_x86_64.whl (1.6 MB view hashes)

Uploaded PyPy manylinux: glibc 2.12+ x86-64

pymeos-0.0.9-pp36-pypy36_pp73-macosx_10_9_x86_64.whl (655.4 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

pymeos-0.0.9-cp38-cp38-win_amd64.whl (400.3 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

pymeos-0.0.9-cp38-cp38-manylinux2010_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

pymeos-0.0.9-cp38-cp38-macosx_10_9_x86_64.whl (664.3 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

pymeos-0.0.9-cp37-cp37m-win_amd64.whl (384.8 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

pymeos-0.0.9-cp37-cp37m-manylinux2010_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

pymeos-0.0.9-cp37-cp37m-macosx_10_9_x86_64.whl (631.5 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

pymeos-0.0.9-cp36-cp36m-win_amd64.whl (384.8 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

pymeos-0.0.9-cp36-cp36m-manylinux2010_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

pymeos-0.0.9-cp36-cp36m-macosx_10_9_x86_64.whl (631.4 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

pymeos-0.0.9-cp35-cp35m-win_amd64.whl (384.8 kB view hashes)

Uploaded CPython 3.5m Windows x86-64

pymeos-0.0.9-cp35-cp35m-manylinux2010_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

pymeos-0.0.9-cp35-cp35m-macosx_10_9_x86_64.whl (632.0 kB view hashes)

Uploaded CPython 3.5m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page