You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "james-willis (via GitHub)" <gi...@apache.org> on 2026/09/04 19:47:18 UTC

[I] RS_ZonalStats line rois: all_touched is ignored, and the default rule burns every traversed cell [sedona]

james-willis opened a new issue, #3322:
URL: https://github.com/apache/sedona/issues/3322

   Probing `RS_ZonalStats` with LINESTRING rois on a 20x20 unit-pixel grid (the GH-3118 `RasterizationTests` fixtures) against GDAL/rasterio ground truth shows two line-specific behaviors in the rasterization path:
   
   1. **`all_touched=true` is ignored for line geometries.** The count never changes with the flag; cells that the segment's envelope touches but does not cross are never included. GDAL/rasterio `all_touched=True` includes them.
   
      | segment | default | all_touched (Sedona) | all_touched (GDAL/rasterio) |
      |---|---|---|---|
      | `LINESTRING (1.5 2.75, 10.5 7.25)` | 10 | 10 | 15 |
      | `LINESTRING (0.75 1.25, 4.25 11.75)` | 11 | 11 | 15 |
      | `LINESTRING (2.5 2.5, 9.5 9.5)` | 8 | 8 | 15 |
   
   2. **The default (no `all_touched`) line rule burns every traversed cell.** GDAL's default line rasterization uses the centre/diamond crossing rule, which burns fewer: e.g. `LINESTRING (1.3 2.7, 8.6 11.4)` burns 17 cells in Sedona but 10 in GDAL/rasterio. (Corner-crossing segments mask this — their traversal and diamond counts coincide, which is why the GH-3118 fixtures agree by default.)
   
   Together these mean a line roi's zonal statistics differ from GDAL-based engines in both flag positions. Surfaced by the SedonaDB↔Sedona Spark parity suite (apache/sedona-db `integration/spark-parity`), where SedonaDB (GDAL rasterizer) matches rasterio in all four regimes.
   
   GH-3118's direction-independence itself holds in every probed case (forward and reversed WKTs agree), as does the polygon path (the coastline fixture's pinned 1738/1842 counts match exactly).
   


-- 
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.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] RS_ZonalStats line rois: all_touched is ignored, and the default rule burns every traversed cell [sedona]

Posted by "sudhamsh-git (via GitHub)" <gi...@apache.org>.
sudhamsh-git commented on issue #3322:
URL: https://github.com/apache/sedona/issues/3322#issuecomment-6261943574

   Hi, I'd like to work on part 1 of this (all_touched being ignored for lines). I'm a student contributing as part of a university software engineering course. rasterizeGeometry never passes allTouched to rasterizeLineString, so lines burn the same cells either way. I have a fix that follows GDAL's ALL_TOUCHED line walk (GDALdllImageLineAllTouched), which gives 15 cells for the three segments here, with tests based on those numbers. I'll leave part 2 alone since it changes default results. Does that sound OK?


-- 
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