feat: OO support for the cbuffer, npoint, pose and rgeometry temporal types#88
Open
estebanzimanyi wants to merge 1 commit into
Open
feat: OO support for the cbuffer, npoint, pose and rgeometry temporal types#88estebanzimanyi wants to merge 1 commit into
estebanzimanyi wants to merge 1 commit into
Conversation
4757f90 to
98f5065
Compare
…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.
98f5065 to
a5a558f
Compare
This was referenced May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_cffifunctions existed on the 1.4 line); after this PR they are first-class PyMEOS types likeTPoint/TFloat.What
TNpoint,TCbuffer,TPose,TRgeometry(+…Inst/…Seq/…SeqSet).Npoint,Cbuffer,PoseandNpointSet/CbufferSet/PoseSet.rgeometry's base value is a shapely geometry (reuses the existingGeometrySet), as MEOS exposes no rgeometry base/set family._TemporalFactory/_CollectionFactoryand exported frompymeos. 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_cffi1.4 does not yet wrap theT_TCBUFFER/T_TPOSE/T_TRGEOMETRY(andT_CBUFFER/T_POSE/… set) tags in itsMeosTypeenum, although the C constants are present in the compiled binding. The factory resolves these via_meos_cffi.lib— the same sourcepymeos_cffibuilds 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 inenums.pyfor 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:
trgeometryhas no string input parser (trgeo_inabsent in MEOS) — constructed viafrom_geometry_tpose/TRgeometryInst(geometry=, pose=, timestamp=)/from_hexwkb.econtains/tintersects/…), present mainly fortcbuffer/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_cffifunctions are built there); the package is statically validated (py_compile) here.