Skip to content

feat(bindings): tgeography parity — full surface, mirrors tgeometry#91

Closed
estebanzimanyi wants to merge 1 commit intocumulative-tgeometryfrom
feat/parity-tgeography
Closed

feat(bindings): tgeography parity — full surface, mirrors tgeometry#91
estebanzimanyi wants to merge 1 commit intocumulative-tgeometryfrom
feat/parity-tgeography

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

Summary

Adds the geographic-coordinate-system temporal type tgeography, mirroring the comprehensive tgeometry PR (#90) almost line-for-line. The MEOS C functions backing this surface are subtype-agnostic, so this is largely a mechanical search-and-replace — `TGeometryTypes` → `TGeographyTypes`, `TGEOMETRY()` → `TGEOGRAPHY()`, `tgeometry_` → `tgeography_`, plus a few case-by-case fixes for coercions.

What's included

Layer Source What it adds
Type registration + constructors + I/O src/geo/tgeography.cpp + tgeography_in_out.cpp The tgeography type, tgeographyInst / tgeographySeq constructors, asText / asEWKT
Foundational accessors / restrict / modifiers / comparison src/geo/tgeography.cpp Same surface as tgeometry's foundational layer (~50 names)
Cross-type predicates (box / position / spatial-rels / temporal-spatial-rels / distance) src/geo/tgeography_ops.cpp Same surface as tgeometry's cross-type layer (~100 names)
Spatial functions src/geo/tgeography_ops.cpp SRID, setSRID, transform, stbox, tgeometry(tgeography) / tgeography(tgeometry) coercions, centroid, convexHull, traversedArea
Aggregate wiring src/temporal/span_aggregates.cpp, src/temporal/temporal_aggregates.cpp extent(tgeography) → stbox; TcountAgg(tgeography) → tint; MergeAgg(tgeography); AppendInstantAgg(tgeography); AppendSequenceAgg(tgeography)
Tile / box emitters + analytics src/geo/tgeography_ops.cpp spaceBoxes, spaceTimeBoxes, the four *Simplify registrations

Stacked on top of #90

This PR is targeted to merge into cumulative-tgeometry (PR #90). It depends on the tgeometry surface and the prerequisite work (#85 / #86 / #87 / #88) bundled there.

Defaults / quirks

  • tgeography defaults to SRID 4326 (WGS84) — geometry payloads in test outputs all start with 0101000020E6100000….
  • extent(tgeography) emits SRID=4326;GEODSTBOX rather than STBOX to mark the geographic coordinate system.
  • The tgeogpoint coercions are not registered — tgeogpoint is not yet a registered DuckDB type in MobilityDuck. The tgeometry ↔ tgeography coercion is registered.

Out of scope

Test plan

  • test/sql/parity/041_tgeography_parity.test — 19 assertions covering accessors, time-domain restrict, modifiers, comparison, box predicates, position predicates, spatial functions (including SRID + coercions), and aggregate wiring.
  • All 143 cumulative-base assertions still pass (001_set, 025_temporal_tile_getters, 026_single_tile_getters, 030_aggregates_extent, 031_aggregates_skiplist, 040_tgeometry_parity).

🤖 Generated with Claude Code

Adds the geographic-coordinate-system temporal type tgeography. The MEOS
C functions backing this surface are subtype-agnostic, so the bulk of
this commit is a mechanical mirror of the tgeometry registrations:
search-and-replace TGeometryTypes -> TGeographyTypes, TGEOMETRY()
-> TGEOGRAPHY(), tgeometry_* -> tgeography_*, plus a small number of
case-by-case fixes for the tgeometry <-> tgeography coercions
(tgeogpoint coercions are deferred until tgeogpoint is registered).

Files added:

  src/include/geo/tgeography.hpp
  src/include/geo/tgeography_ops.hpp
  src/geo/tgeography.cpp           — type registration, constructors,
                                      foundational accessors, time/value
                                      restrict, modifiers, comparison
  src/geo/tgeography_in_out.cpp    — text I/O (asText, asEWKT) and
                                      string casts
  src/geo/tgeography_ops.cpp       — cross-type predicates (boxops,
                                      posops, spatial-rels, temporal-
                                      spatial-rels), distance,
                                      spatial functions, tile / box
                                      emitters, analytics
  test/sql/parity/041_tgeography_parity.test — 19 assertions

Aggregate wiring extended in span_aggregates.cpp /
temporal_aggregates.cpp to register tgeography overloads alongside
tgeometry / tgeompoint for extent / TcountAgg / MergeAgg /
AppendInstantAgg / AppendSequenceAgg.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@estebanzimanyi
Copy link
Copy Markdown
Member Author

Consolidated into #92 (cumulative parity tip). The full tgeometry → tgeography → tgeogpoint chain is now reviewable as a single PR; this branch's commits are preserved in #92's history.

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