Skip to content

feat(raster): bind rasterTileValueQuadbin and trajectoryQuadbins for Raquet sampling#205

Open
estebanzimanyi wants to merge 4 commits into
mainfrom
feat/parity-raster-quadbin
Open

feat(raster): bind rasterTileValueQuadbin and trajectoryQuadbins for Raquet sampling#205
estebanzimanyi wants to merge 4 commits into
mainfrom
feat/parity-raster-quadbin

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Expose two MEOS raster kernel functions as DuckDB scalar functions, completing MobilityDuck parity with MobilityDB's Raquet raster-chip sampling surface.

rasterTileValueQuadbin(pixels BLOB, width INT, height INT, cell QUADBIN, pixtype VARCHAR, nodata DOUBLE, has_nodata BOOL, traj TGEOMPOINT) → TFLOAT samples a row-major Raquet band pixel buffer along a tgeompoint trajectory keyed by a QUADBIN cell id, returning the sampled values as TFLOAT. Supports all five MEOS pixel types: UINT8, INT16, INT32, FLOAT32, FLOAT64.

trajectoryQuadbins(traj TGEOMPOINT, zoom INT) → LIST(QUADBIN) returns the distinct QUADBIN cells at a given zoom level covered by the trajectory, for use as a WHERE-clause join key against a Raquet table.

-DRASTER=ON is added to the portfile vcpkg_cmake_configure OPTIONS so raster_quadbin.c is compiled into libmeos and the #if RASTER declarations in meos.h are visible; -DRASTER=1 is added to CMakeLists.txt so MobilityDuck C++ translation units see the same guard. RasterQuadbinFunctions is wired into the extension loader after QuadbinTypes registration. Smoke tests cover cardinality and cell identity of trajectoryQuadbins at zoom 0, the 1×1 UINT8 sampling path, and the outside-bbox NULL path.

…o d94af2d2c9

Registers QUADBIN as a BIGINT alias and TQUADBIN as a BLOB-backed
temporal type. Exposes quadbinTileToCell, quadbinCellToTileX/Y/Z,
quadbinGetResolution, quadbinIsValidCell, tquadbin (instant
constructor), startValue, endValue, valueN, values, valueAtTimestamp,
and cellToQuadkey, all routed through the serial MEOS executor.
Advances the vcpkg MEOS pin to ecosystem-pin-2026-06-16g
(d94af2d2c9), the first pin that carries the QUADBIN family in the
public MEOS surface (meos_quadbin.h).
Two portfile workarounds are removed because the upstream pin carries the
fixes: meos/CMakeLists.txt already links the QUADBIN object library into
MEOS_OBJECTS, and meos_catalog.c basetype_byvalue contains a single merged
return statement covering H3 and QUADBIN.

The raster chip-sampling additions in this pin (raster_tile_value_quadbin,
trajectory_quadbins, MeosPixType) are gated by #if RASTER in meos.h and
compiled only when -DRASTER=ON; the MobilityDuck build uses the default
RASTER=OFF so no new bindings are needed.
Folds MobilityDB PR #1227: make the four file-scope static accumulators
in tpoint_geom_clip.c (events, intervals, periods, rtree_results)
per-thread with MEOS_TLS to prevent heap corruption under concurrent
DuckDB executor threads.
…Raquet sampling

Expose two MEOS raster kernel functions as DuckDB scalar functions, completing
MobilityDuck parity with MobilityDB's Raquet raster-chip sampling surface.

rasterTileValueQuadbin(pixels BLOB, width INT, height INT, cell QUADBIN,
  pixtype VARCHAR, nodata DOUBLE, has_nodata BOOL, traj TGEOMPOINT) → TFLOAT
samples a row-major Raquet band pixel buffer along a tgeompoint trajectory keyed
by a QUADBIN cell id, returning the sampled values as TFLOAT.  Supports all five
MEOS pixel types: UINT8, INT16, INT32, FLOAT32, FLOAT64.

trajectoryQuadbins(traj TGEOMPOINT, zoom INT) → LIST(QUADBIN)
returns the distinct QUADBIN cells at a given zoom level covered by the
trajectory, for use as a WHERE-clause join key against a Raquet table.

Implementation adds -DRASTER=ON to the portfile vcpkg_cmake_configure OPTIONS so
raster_quadbin.c is compiled into libmeos and the #if RASTER declarations in
meos.h are visible; adds -DRASTER=1 to CMakeLists.txt so MobilityDuck C++
translation units see the same guard; wires RasterQuadbinFunctions into the
extension loader after QuadbinTypes registration.

Smoke tests cover cardinality and cell identity of trajectoryQuadbins at zoom 0,
the 1×1 UINT8 sampling path, and the outside-bbox NULL path.
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