Sample a raster file along a trajectory through GDAL - #249
Merged
estebanzimanyi merged 2 commits intoAug 7, 2026
Conversation
The pin carries the MEOS raster sampling entry points and, with them, four upstream changes the fixtures have to follow. minusStbox returns the complement of the corresponding at restriction, so removing a box that covers [2000-01-01, 2000-01-02] from a three-instant trajectory leaves the fragment after 2000-01-02 rather than nothing. An h3index text literal is hexadecimal, as in h3-pg and in MobilityDB's own 288_th3index_compops test; a numeric cell reaches the type through a bigint cast. A decimal string of more than sixteen digits parses as hexadecimal, overflows and saturates, so every such literal collapses to the same invalid cell and unrelated cells compare equal. pgpointcloud sizes a serialized point as sizeof(SERIALIZED_POINT) - 1 plus the schema point size, and a serialized patch from the buffer-aligned header, both of which reserve bytes past the written content: three for a point (12 - 1 + 24 = 35), fifteen for a patch (64 - 1 - 48 = 15). MEOS emits that reserved tail as zeros, so the literals carry it; without it the tail rule reaches into the last coordinate.
MEOS opens a raster in any GDAL-supported format, derives the bounding-box pre-filter from its geotransform and samples a band at the instants of a trajectory. MobilityDuck exposes that as five functions, each with and without an explicit band, mirroring the MobilityDB argument order: rasterValue(rasterfile, traj[, band]) -> tfloat atRasterValue(traj, rasterfile, vspan[, band]) -> tgeompoint minusRasterValue(traj, rasterfile, vspan[, band]) -> tgeompoint eRasterValue(rasterfile, traj, vspan[, band]) -> boolean aRasterValue(rasterfile, traj, vspan[, band]) -> boolean The trajectory carries the coordinates of the raster's own reference system, which the geotransform maps to pixels. The ever and always predicates answer with three-valued logic, so the answer that does not apply surfaces as NULL. test/sql/raster_value.test samples test/data/raster_4326.tif, a 2x2 UINT8 raster holding one value per world quadrant, and covers the per-quadrant values, the band argument, the restriction and its complement, ever against always, and the rejected band and path.
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.
MEOS opens a raster in any GDAL-supported format, derives the bounding-box
pre-filter from its geotransform and samples a band at the instants of a
trajectory. MobilityDuck exposes that as five functions, each with and without
an explicit band, in the MobilityDB argument order:
rasterValue(rasterfile, traj[, band])tfloat— the sampled valuesatRasterValue(traj, rasterfile, vspan[, band])tgeompoint— instants whose pixel is inside the rangeminusRasterValue(traj, rasterfile, vspan[, band])tgeompoint— the complementeRasterValue(rasterfile, traj, vspan[, band])boolean— ever insideaRasterValue(rasterfile, traj, vspan[, band])boolean— always insideThe trajectory carries the coordinates of the raster's own reference system,
which the geotransform maps to pixels. The ever and always predicates answer
with three-valued logic, so the answer that does not apply is NULL.
Together with the Raquet tile sampling, the raster surface covers both sources:
rasterTileValuesamples a tile held in the database,rasterValuesamples araster file on disk.
test/sql/raster_value.testsamplestest/data/raster_4326.tif, a 2x2 UINT8raster holding one value per world quadrant, and covers the per-quadrant values,
the band argument, the restriction and its complement, ever against always, and
the rejected band and path.
The base branch carries the MEOS pin these entry points need.
Full suite green on this commit: 1813 assertions in 78 test cases.