Skip to content

MobilityDB/MEOS

Repository files navigation

MEOS

Mobility Engine, Open Source

Test MEOS compilation

MEOS is a C library for manipulating temporal and spatio-temporal data. It provides the type system and operations that power MobilityDB, and can also be used standalone — embedded in any C application or wrapped through one of its language bindings.

MEOS implements the ISO 19141:2008 standard Geographic information — Schema for moving features, with extensions for non-spatial attribute changes and for the temporal gaps that naturally arise when collecting mobility data (intervals during which the position of a moving object is not observed).

The name and design philosophy are inspired by GEOS (Geometry Engine, Open Source). The official project website is libmeos.org.

What MEOS Provides

  • Temporal types for tracking how a value changes over time:

    • tbool, tint, tfloat, ttext — temporal versions of base types
    • tgeompoint, tgeogpoint — temporal geometry/geography points
    • tgeometry, tgeography — temporal geometries/geographies (any shape)
    • Optional: tcbuffer (circular buffers), tnpoint (network points), tpose (rigid-body poses), trgeometry (rigid geometries)
  • Temporal subtypes capturing different observation patterns:

    • Instant — a single value at a single time
    • Sequence — a contiguous interval of values, with linear or step interpolation
    • SequenceSet — multiple disjoint sequences, naturally representing temporal gaps
  • Bounding box typestbox (temporal numeric box) and stbox (spatio-temporal box) for fast indexing and pruning

  • Set & span typesintset, bigintset, floatset, textset, dateset, tstzset, plus intspan, floatspan, datespan, tstzspan and their span sets

  • Operations — construction, parsing, output (WKT, WKB, MF-JSON), aggregation, distance, spatial relationships, temporal tiling, simplification, and more

Project Structure

MEOS/
├── include/        # Public headers (meos.h, meos_geo.h, meos_internal.h, ...)
├── src/            # Source files
│   ├── temporal/   #   Core temporal types and operations
│   ├── geo/        #   Spatio-temporal types and operations
│   ├── cbuffer/    #   Circular buffers (optional)
│   ├── npoint/     #   Network points (optional)
│   ├── pose/       #   Geoposes (optional)
│   └── rgeo/       #   Rigid geometries (optional)
├── postgres/       # Embedded PostgreSQL compatibility layer (date/time, utils)
├── postgis/        # Embedded PostGIS code (liblwgeom, ryu)
├── examples/       # Example programs (hello world, AIS ingestion, BerlinMOD, ...)
├── test/           # Standalone tests
└── tools/          # pkg-config template

MEOS is self-contained: it embeds the parts of PostgreSQL and PostGIS it needs, so the only external dependencies at runtime are GEOS, PROJ, JSON-C, and GSL.

Requirements

  • Linux (other UNIX-like systems may work, but remain untested)
  • CMake >= 3.12
  • A C compiler (GCC or Clang)
  • GEOS >= 3.8
  • PROJ >= 6.1
  • JSON-C
  • GNU Scientific Library (GSL)

On Debian/Ubuntu:

sudo apt install build-essential cmake libgeos-dev libproj-dev libjson-c-dev libgsl-dev

Building & Installation

git clone https://github.com/MobilityDB/MEOS
mkdir MEOS/build
cd MEOS/build
cmake ..
make
sudo make install

The build produces libmeos.so (or libmeos.dylib on macOS) and installs the public headers (meos.h, meos_geo.h, meos_internal.h, ...) under ${CMAKE_INSTALL_INCLUDEDIR}.

Build options

Option Default Description
CBUFFER OFF Include circular buffer types
NPOINT ON Include network point types
POSE OFF Include geopose types
RGEO OFF Include rigid geometry types (requires POSE=ON)
BUILD_SHARED_LIBS ON Build as shared library; set OFF for a static library
DEBUG_EXPAND OFF Print debug messages for expandable data structures

Example:

cmake -DCBUFFER=ON -DPOSE=ON ..

Hello, MEOS

#include <stdio.h>
#include <stdlib.h>
#include <meos.h>
#include <meos_geo.h>

int main(void)
{
  meos_initialize();

  Temporal *t = tgeompoint_in("[POINT(1 1)@2000-01-01, POINT(2 2)@2000-01-02]");
  char *out = temporal_as_mfjson(t, true, 6, 0, NULL);
  printf("%s\n", out);

  free(out);
  free(t);
  meos_finalize();
  return 0;
}

Compile and run:

gcc -Wall -g -I/usr/local/include -o hello hello.c -L/usr/local/lib -lmeos
./hello

More example programs are under examples/, including AIS ingestion pipelines, BerlinMOD-based trajectory processing, expandable data structures, simplification, and tiling.

Language Bindings

Because MEOS exposes a stable C API, it is straightforward to call from other languages. Maintained bindings include:

Relationship to MobilityDB

MEOS is the core type system used by MobilityDB, the PostgreSQL extension that brings temporal and spatio-temporal types to SQL. MobilityDB consumes MEOS as a git submodule and recompiles its sources with PostgreSQL-specific bindings.

If you want SQL access to temporal types, install MobilityDB. If you want to embed temporal types in a C application, a pipeline component, or a non-PostgreSQL system, use MEOS directly.

Documentation

License

MEOS is released under the PostgreSQL License. It includes portions of PostGIS source code released under the GNU General Public License (GPLv2 or later).

Acknowledgements

MEOS is developed by the Computer & Decision Engineering Department of the Université libre de Bruxelles (ULB), under the direction of Prof. Esteban Zimányi.

The MobilityDB/MEOS project has received funding from the European Union's Horizon Europe research and innovation programme under grant agreements No 101070279 MobiSpaces and No 101093051 EMERALDS.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages