Skip to content

Bind the raster family: raquet tiles and trajectory sampling - #247

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/duck-raster-family
Aug 7, 2026
Merged

Bind the raster family: raquet tiles and trajectory sampling#247
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/duck-raster-family

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Adds the MEOS raster surface to MobilityDuck, so a Web-Mercator raster tile is
sampled along a trajectory without leaving DuckDB. The pinned libmeos already
carries the family (-DALL=ON enables RASTER, with GDAL linked in), so this is
binding work only — no pin or build change.

RAQUET is a raster tile addressed by a CARTO QUADBIN cell, surfaced as a BLOB
holding the MEOS WKB serialisation of the tile — the wire form its text
representation hex-encodes — so a tile round-trips through Parquet and through
the VARCHAR casts.

Function Purpose
raquet(pixels, width, height, cell, pixtype[, nodata]) build a tile from a pixel band
raquetRead(rasterfile[, cell]) decode a raster file through GDAL
quadbin / width / height / nodata / pixtype / stbox accessors
eq / ne / lt / le / ge / gt / cmp / hash / hashExtended comparisons
rasterTileValue(raquet, tgeompoint) sample one tile → tfloat
rasterTileValue(raquet[], tgeompoint) sample a tile set, highest zoom wins
rasterTileValueQuadbin(pixels, …, tgeompoint) sample a bare pixel band, as a Raquet Parquet row supplies it
trajectoryQuadbins(tgeompoint, zoom) the cells a trajectory covers → LIST(QUADBIN)

raquetRead derives the tile identifier from the raster geotransform when no
cell is given, which requires an EPSG:3857 tile-aligned raster.

MEOS reads a pixel band as width * height packed values and is not told how
long the buffer is, so the binding checks the dimensions and the buffer length
before passing the band on — the same check the MobilityDB raquet constructor
performs.

test/sql/raquet.test covers the constructor and accessors, the text round trip,
both sampling forms, the outside-the-tile and unknown-pixel-type paths, and the
cells a trajectory covers.

Full suite green on this commit: 1777 assertions in 76 test cases.

MobilityDuck gains the MEOS raster surface, so a Web-Mercator raster tile can
be sampled along a trajectory without leaving DuckDB.

RAQUET is a raster tile addressed by a CARTO QUADBIN cell, surfaced as a BLOB
holding the MEOS WKB serialisation of the tile — the wire form its text
representation hex-encodes — so a tile round-trips through Parquet and through
the VARCHAR casts. On top of it:

  raquet(pixels, width, height, cell, pixtype[, nodata])  build a tile
  raquetRead(rasterfile[, cell])                          decode via GDAL
  quadbin / width / height / nodata / pixtype / stbox     accessors
  eq / ne / lt / le / ge / gt / cmp / hash / hashExtended  comparisons
  rasterTileValue(raquet, tgeompoint)                     sample one tile
  rasterTileValue(raquet[], tgeompoint)                   sample a tile set
  rasterTileValueQuadbin(pixels, …, tgeompoint)           sample a pixel band
  trajectoryQuadbins(tgeompoint, zoom)                    covered cells

raquetRead derives the tile identifier from the raster geotransform when no
cell is given, which requires an EPSG:3857 tile-aligned raster.

MEOS reads a pixel band as width x height packed values and is not told how
long the buffer is, so the dimensions and the buffer length are checked before
the band is passed on, as the MobilityDB raquet constructor does.

test/sql/raquet.test covers the constructor and accessors, the text round trip,
both sampling forms, the outside-the-tile and unknown-pixel-type paths, and the
cells a trajectory covers.
@estebanzimanyi
estebanzimanyi merged commit bfc3afc into MobilityDB:main Aug 7, 2026
9 checks passed
@estebanzimanyi
estebanzimanyi deleted the feat/duck-raster-family branch August 7, 2026 17:47
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