apache / apache/sedona

Cross-CRS raster predicates reproject the footprint corner-only, missing most of a polar raster's extent

Open
#3,323 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

When a raster predicate must compare across CRSs, the raster's footprint appears to be reprojected using its corner vertices only. Reprojection bends straight footprint edges into curves, so the corner-to-corner chords under-cover the true extent — dramatically so for polar rasters, where the chords miss most of the cap.

Repro: a 20x20 EPSG:3413 raster with extent (-1e6, -1e6, 1e6, 1e6) (a 2000 km square on the north pole), queried with EPSG:4326 points that transform to well inside the square:

| point (4326) | in EPSG:3413 | truly inside? | RS_Intersects |
|---|---|---|---|
| `POINT(45 82)` | (867972, 0) | yes | **false** |
| `POINT(180 85)` | (-383228, 383228) | yes | **false** |
| `POINT(0 85)` | (383228, -383228) | yes | **false** |
| `POINT(90 85)` | (383228, 383228) | yes | **false** (also via RS_Contains) |
| `POINT(0 60)` | (2349829, -2349829) | no | false ✓ |

`POINT(45 82)` sits on the +x axis at 87% of the half-width — nowhere near an edge curve subtlety — yet reads false; the four corners transform to lon/lat points near latitude 77-78, and everything poleward of their chords is lost. Densifying each footprint edge before reprojecting (a handful of interior points per edge) makes the reprojected footprint follow the curve; SedonaDB's `integration/spark-parity` suite (where this surfaced) shows its densified footprint matching the exact point-in-square truth on every probed case.

Related, observed while probing: `RS_Within(polar_raster, pole-spanning 4326 polygon)` throws rather than answering — the pole/antimeridian degeneracy in flat lon/lat space.

Contributor guide

Open the contributing guide

Research direction

Start with the integration/spark-parity suite, where the polar EPSG:3413 versus EPSG:4326 cases surfaced, and reproduce the listed point predicates. Inspect the cross-CRS raster footprint reprojection path and its handling of footprint edges. Done means densified footprints cover the true polar extent so the listed inside points return true, while the outside point remains false.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.