Python wrapper for the MEOS C Library.
Project description
MEOS (Mobility Engine, Open Source) is a C library which enables the manipulation of temporal and spatio-temporal data based on MobilityDB's data types and functions.
PyMEOS is a library built on top of MEOS that provides all of its functionality wrapped in a set of Python classes.
For the PyMEOS CFFI library, the middle layer between MEOS and PyMEOS, see the PyMEOS CFFI repository.
Usage
Installation
You can install PyMEOS (pymeos
and pymeos-cffi
) using pip
, conda
, or from sources.
Using pip
pip install pymeos
PyMEOS wheel should be compatible with any system, but it is possible that the pre-built distribution is not available for PyMEOS CFFI for some OS/Architecture.
Using conda
PyMEOS is also available on the conda-forge channel. To install it, first add the conda-forge channel to your conda configuration:
conda config --add channels conda-forge
conda config --set channel_priority strict
Then, you can install PyMEOS using the following command:
conda install conda-forge::pymeos
Source installation
For detailed instructions on how to install PyMEOS from sources, see the installation page in the PyMEOS Documentation.
Sample code
IMPORTANT Before using any PyMEOS function, always call
pymeos_initialize
. Otherwise, the library will crash with aSegmentation Fault
error. You should also always callpymeos_finalize
at the end of your code.
from pymeos import pymeos_initialize, pymeos_finalize, TGeogPointInst, TGeogPointSeq
# Important: Always initialize MEOS library
pymeos_initialize()
sequence_from_string = TGeogPointSeq(
string='[Point(10.0 10.0)@2019-09-01 00:00:00+01, Point(20.0 20.0)@2019-09-02 00:00:00+01, Point(10.0 10.0)@2019-09-03 00:00:00+01]')
print(f'Output: {sequence_from_string}')
sequence_from_points = TGeogPointSeq(instant_list=[TGeogPointInst(string='Point(10.0 10.0)@2019-09-01 00:00:00+01'),
TGeogPointInst(string='Point(20.0 20.0)@2019-09-02 00:00:00+01'),
TGeogPointInst(string='Point(10.0 10.0)@2019-09-03 00:00:00+01')],
lower_inc=True, upper_inc=True)
speed = sequence_from_points.speed()
print(f'Speeds: {speed}')
# Call finish at the end of your code
pymeos_finalize()
Output: [POINT(10 10)@2019-09-01 01:00:00+02, POINT(20 20)@2019-09-02 01:00:00+02, POINT(10 10)@2019-09-03 01:00:00+02]
Speeds: Interp=Step;[17.84556057812839@2019-09-01 01:00:00+02, 17.84556057812839@2019-09-03 01:00:00+02]
For more examples and use-cases, see PyMEOS Examples repository
Documentation
Visit our ReadTheDocs page for a more complete and detailed documentation, including an installation manual and several examples.
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 Distribution
File details
Details for the file pymeos-1.1.4.tar.gz
.
File metadata
- Download URL: pymeos-1.1.4.tar.gz
- Upload date:
- Size: 87.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0ceaeb1886f87c6cfb4fc0af66798600ac2ef27ed585ee81bd977c90ab8065d |
|
MD5 | 5a544a6b9eb000a5ac308d0ab13c350a |
|
BLAKE2b-256 | 0e64bf3d76f8822664e3726024c78cb8580dc639f89fbac5df3b980a77123814 |
File details
Details for the file pymeos-1.1.4-py3-none-any.whl
.
File metadata
- Download URL: pymeos-1.1.4-py3-none-any.whl
- Upload date:
- Size: 128.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc379b7f5860c769d9988302d41d94d2286234e28d475a91bd63f316cd5971c2 |
|
MD5 | a970e0f53e36038caf35d97ff173afa1 |
|
BLAKE2b-256 | 76c95d1ef4349f1404b82413861b6f8cf3fea1cad3df30365ebbeca2959eba78 |