You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "jiayuasu (via GitHub)" <gi...@apache.org> on 2026/09/27 08:06:36 UTC
[PR] [GH-3415] Fix allTouched rasterization dropping the row or column across a grid line [sedona]
jiayuasu opened a new pull request, #3417:
URL: https://github.com/apache/sedona/pull/3417
## Did you read the Contributor Guide?
- Yes, I have read the [Contributor Rules](https://sedona.apache.org/latest/community/rule/) and [Contributor Development Guide](https://sedona.apache.org/latest/community/develop/)
## Is this PR related to a ticket?
- Yes, and the PR name follows the format `[GH-XXX] my subject`. Closes #3415
## What changes were proposed in this PR?
**Stacked on #3416.** Until that merges, this PR also shows its commit; the changes for this issue are the last two commits. I'll rebase once #3416 lands.
- **Tolerant grid-line check.** In `rasterizeGeomExtent`, the four `allTouched` expansion checks compared the geometry envelope with the snapped grid line using `==`. The snap goes through a BigDecimal round trip and can land a few ULPs off the grid line computed in double arithmetic (59.99916666666667 vs 59.99916666666666), so the extent was not widened and the touched row or column across the line was never visited. The checks now use `isOnGridLine`, which allows 8 ULPs of the largest operand (raster origin included, so a grid line near zero is judged against the origin's magnitude). The widened extent is only the search window; each cell is still tested against the geometry, so a point strictly inside one row does not burn its neighbour.
- **Regression test for line rasterization at the far raster edges.** Lines that leave the raster through its right or bottom edge, or end exactly on it, keep the edge pixels on a 1/3600 degree tile. This already passes on master and guards the edge handling in `burnCell`.
## How was this patch tested?
- New `RasterizationTest` cases: a point on a row line, a column line and a corner, full-extent and cropped, on a tile away from the origin; the #3414 point on the row 0/1 line, which now burns `(10,0)` and `(10,1)`; and a point just inside a row that must burn only that row. The two grid-line tests fail on #3416 alone (`[(10,0)]` vs `[(10,0), (10,1)]`, `[(10,36)]` vs `[(10,35), (10,36)]`) and pass with this change: 23 run, 0 failures.
- All tests under `org.apache.sedona.common.raster`: 504 run, 0 failures. Spark `rasteralgebraTest` and `rasterIOTest`: 192 passed, 0 failed.
- Randomized probe (seed 444), 400 points each exactly on horizontal lines, vertical lines and corners of 1/3600 degree tiles, `allTouched = true`. Touched cells dropped (full extent): master 109 / 94 / 180, #3416 alone 65 / 67 / 132, with this PR 0 / 0 / 0; cropped output is also 0 / 0 / 0.
- The 211-case GDAL parity corpus: 0 mismatches.
## Did this PR include necessary documentation updates?
- No, this PR does not affect any public API so no need to change the documentation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [GH-3415] Fix allTouched rasterization dropping the row or column across a grid line [sedona]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on PR #3417:
URL: https://github.com/apache/sedona/pull/3417#issuecomment-5884278309
Closing in favour of #3425.
Checking against GDAL showed that this PR's premise, that a point lying exactly on a grid line should burn the cells on both sides with `allTouched`, is not what GDAL does. GDAL (3.12, via rasterio) treats every cell as half-open. A point on a row line, a column line or a grid corner burns exactly one cell, the one to its right/below, with or without `all_touched`, and a geometry never burns a cell it touches only on its boundary. #3120 already moved Sedona to that rule for lines.
The same check covered both review findings here:
- **Tolerance:** the grid-line tolerance this PR adds, and the widening it feeds, go away under the half-open rule.
- **Edge touch:** GDAL burns nothing for a polygon that only touches the raster's edge, in either mode. Burning the touched column would also make per-tile zonal counts disagree with a single mosaic raster for a zone that ends on a tile boundary.
#3425 lists the cases where Sedona master still differs from GDAL and proposes aligning them, with grid-aligned cases added to the GDAL parity suite. The far-edge line regression test from this PR matches GDAL and will carry over.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [GH-3415] Fix allTouched rasterization dropping the row or column across a grid line [sedona]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu closed pull request #3417: [GH-3415] Fix allTouched rasterization dropping the row or column across a grid line
URL: https://github.com/apache/sedona/pull/3417
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org