james-willis opened a new pull request, #3119: URL: https://github.com/apache/sedona/pull/3119
## 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 #3118 ## What changes were proposed in this PR? `Rasterization` burned line/ring segments by sampling them at fixed 0.2-pixel steps and flooring each sample to a cell (`drawLineBresenham`). A cell is only burned if a sample lands inside it, so a cell the segment crosses over a chord shorter than the step could fall between two samples and be missed. This replaced the sampler with exact grid traversal (Amanatides–Woo): the segment is walked from one cell-boundary crossing to the next, so every cell it enters is burned. This fixes both `LINESTRING` rasterization and polygon-boundary selection under `allTouched = true` (which affects `RS_AsRaster`, `RS_Clip`, `RS_ZonalStats`/`RS_ZonalStatsAll`, and `RS_SetValues`). This PR is stacked on #3113 (the non-square-pixel scanline fix); review that one first. Small known deviation from GDAL: when a vertex lands exactly on a grid line, the geometry touches a cell only at a corner or edge. This exact traversal burns that cell (a superset consistent with the documented "all pixels touched by the geometry"), whereas GDAL omits it. This only occurs at exact grid-aligned vertices (never on general input) and GDAL's own behaviour there is inconsistent, so it is not pursued here — a follow-up issue tracks it. ## How was this patch tested? - New `testAsRasterTouchedPixelsExactTraversal`: a polygon boundary and a `LINESTRING` that each clip a pixel over a sub-pixel chord, on a square unit grid; expected matrices from GDAL (`rasterio.features.rasterize`, all_touched=True). Written first, failed on the sampler. - The seeded 100-case `allTouched` fuzz added on #3113 (`python/tests/sql/test_rasterize_parity.py`) matches GDAL exactly with this fix; its two strict-`xfail` markers (the allTouched polygon corpus and the LineString case) become passing assertions here. - Existing `RS_AsRaster`/`RS_Clip`/`RS_ZonalStats`/`RS_SetValues` expectations that had encoded the sampler's missed boundary pixels are updated; each change was verified against GDAL/rasterio. `RS_ZonalStats` allTouched count on the edge-case geometry goes 1832 → 1842 (the 10 boundary pixels GDAL also selects). Full `common` module suite passes (1147 tests). ## 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
