Raquet / QUADBIN Sampling

Raquet is a cloud-native raster format that stores raster tiles as rows in an Apache Parquet file. Each row holds the pixel bytes for one Web-Mercator tile together with its QUADBIN cell identifier — a 64-bit integer that encodes the tile's zoom level and Morton-interleaved x/y coordinates. No separate spatial metadata is required: the bounding box and pixel-to-coordinate mapping are fully determined by the QUADBIN value.

The typical query pattern joins a trajectory against a Raquet table in two steps:

-- Step 1: identify which tiles the trajectory overlaps
SELECT DISTINCT q
FROM unnest(trajectory_quadbins(traj, 8)) AS q;

-- Step 2: sample each matching tile
SELECT raster_tile_value_quadbin(
    band_data, width, height, quadbin, 'FLOAT32', nodata, true, traj)
FROM elevation_raquet
WHERE quadbin = ANY(trajectory_quadbins(traj, 8));