apache / apache/sedona

RS_ raster predicates: transform geometry into the raster CRS for cross-CRS comparison (match SedonaDB)

Open
#3,155 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.4k
Forks
784
Avg merge
1d 12h
Merged PRs (30d)
58

Description

For a cross-CRS raster/geometry predicate, `RS_Intersects`/`RS_Contains`/`RS_Within` currently transform **both** operands into WGS84 (EPSG:4326) and compare there. Because the raster footprint is reprojected to WGS84 with straight chords between its four corners, its edges are approximated — this is the motivation for densifying the footprint (#3154).

SedonaDB's RS_ predicate implementation instead transforms the **geometry into the raster's CRS** and compares in the raster's native frame. A raster footprint is exactly a straight-edged quadrilateral in its own CRS (pixel→world is affine, and affine maps lines to lines), so keeping the raster in its native CRS makes its footprint exact and moves the reprojection onto the (usually smaller, often point) geometry. That is more accurate for the common point-in-raster case, and it removes the need to densify the raster footprint's edges at all.

Consider matching this behavior: transform the geometry into the raster's CRS rather than reprojecting both to WGS84.

Related: this is largely an alternative to the raster-side densification in #3154 (keeping the raster native avoids the curved-edge approximation entirely), and to the SedonaDB-side frame-divergence discussion in apache/sedona-db#1076.

Contributor guide

Open the contributing guide

Research direction

Start with the RS_Intersects, RS_Contains, and RS_Within implementations and trace their cross-CRS handling. Compare that behavior with SedonaDB's predicate implementation and the discussion in apache/sedona-db#1076. Done means the geometry is transformed into the raster's CRS for comparison while the raster remains native; assess whether this makes #3154's densification unnecessary.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.