Skip to content

feat: OO support for the cbuffer, npoint, pose and rgeometry temporal types#88

Open
estebanzimanyi wants to merge 1 commit into
bump/meos-1.4from
feat/extended-temporal-types
Open

feat: OO support for the cbuffer, npoint, pose and rgeometry temporal types#88
estebanzimanyi wants to merge 1 commit into
bump/meos-1.4from
feat/extended-temporal-types

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

Stacked on #81 (bump/meos-1.4).

Closes the PyMEOS object-oriented gap for the four extended temporal type families. They had zero OO classes (only the low-level pymeos_cffi functions existed on the 1.4 line); after this PR they are first-class PyMEOS types like TPoint/TFloat.

What

  • main: TNpoint, TCbuffer, TPose, TRgeometry (+ …Inst/…Seq/…SeqSet).
  • collections: base value types Npoint, Cbuffer, Pose and NpointSet/CbufferSet/PoseSet. rgeometry's base value is a shapely geometry (reuses the existing GeometrySet), as MEOS exposes no rgeometry base/set family.
  • factory + exports: all four families wired into _TemporalFactory/_CollectionFactory and exported from pymeos. Tests added per family.

Each method delegates to the operator's own MEOS C function (reuse, no reimplementation), so the new types behave identically to the rest of the API.

CFFI enum robustness

pymeos_cffi 1.4 does not yet wrap the T_TCBUFFER/T_TPOSE/T_TRGEOMETRY (and T_CBUFFER/T_POSE/… set) tags in its MeosType enum, although the C constants are present in the compiled binding. The factory resolves these via _meos_cffi.lib — the same source pymeos_cffi builds its own enums from — so the package imports cleanly and the types activate in CI now. Recommended follow-up (separate repo, PyMEOS-CFFI): wrap these members in enums.py for direct user access.

Scope / honest limitations

Each class covers its available MEOS surface (constructors, I/O, conversions, accessors, SRID/transform, ever/always, temporal comparisons, restrictions, distance). Where MEOS provides no backing function the method is omitted rather than faked:

  • trgeometry has no string input parser (trgeo_in absent in MEOS) — constructed via from_geometry_tpose / TRgeometryInst(geometry=, pose=, timestamp=) / from_hexwkb.
  • The temporal spatial-relationship predicate methods (econtains/tintersects/…), present mainly for tcbuffer/trgeometry, are a documented follow-up — kept uniform across the four families rather than partially added.

Runtime is validated by CI on the 1.4 line (the four families' pymeos_cffi functions are built there); the package is statically validated (py_compile) here.

…etry temporal types

Add first-class PyMEOS classes for the four extended temporal type
families, mirroring the existing tpoint/ttext pattern and reusing the
exact pymeos_cffi backing functions (no reimplementation):

- main: TNpoint/TCbuffer/TPose/TRgeometry (+ Inst/Seq/SeqSet)
- collections: base value types Npoint/Cbuffer/Pose (+ their *Set) and
  Nsegment; rgeometry's base is a shapely geometry (reuses GeometrySet)
- factory + package exports wired for all four families; tests added

Each type covers 100% of its real MEOS-backed surface, verified against
the MEOS headers:

- TCbuffer exposes the full spatial-relationship surface MEOS provides
  (ever / always / temporal: contains, covers, disjoint, within-distance,
  intersects, touches), mirroring TPoint.
- MEOS defines no spatial-relationship API for npoint, pose or
  rgeometry, so their relationship surface is complete at zero by
  construction (documented, not excluded, not faked).
- TRgeometry additionally exposes its full backed surface: segments,
  delete (timestamptz/tstzset/tstzspan/tstzspanset), before/after a
  timestamp, to_instant, and the sequence-set accessors
  (start_sequence/end_sequence/sequence_n/sequences) -- each delegating
  to the rigid-geometry-specific trgeo_* function.
- TNpoint.positions() exposes tnpoint_positions via a new Nsegment
  wrapper (full nsegment_* surface).

Omitted only where MEOS provides no usable backing: trgeometry has no
string input parser (built via from_geometry_tpose / hexwkb), and the
Datum-bearing trgeo_restrict_value/values helpers are MEOS-internal
(consistent with how the ecosystem treats Datum helpers).

The factory resolves the four type tags through the compiled binding
(`_meos_cffi.lib`, the same source pymeos_cffi builds its enums from),
so the build imports cleanly and the types activate even where
pymeos_cffi's MeosType enum does not yet wrap the cbuffer/pose/rgeometry
tags.

TCbuffer's value accessors and value-based constructors
(start_value/end_value/value_set/value_at_timestamp, from_base_time,
from_mfjson) raise NotImplementedError citing the missing MEOS backing
(MEOS exposes no typed tcbuffer_* value accessor / tcbufferinst_make;
MF-JSON input is tracked upstream by MobilityDB#1051). This keeps
TCbuffer/Inst/Seq/SeqSet concrete and instantiable rather than abstract.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant