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 20:47:25 UTC

[I] RS_RasterToWorldCoord*/RS_WorldToRasterCoord* are 0-based; Sedona Spark, PostGIS, and RS_PixelAs* are 1-based [sedona-db]

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

   `RS_RasterToWorldCoord`/`X`/`Y` and `RS_WorldToRasterCoord`/`X`/`Y` treat pixel coordinates as **0-based**, while Sedona Spark (following PostGIS) is **1-based**. Every result is exactly one pixel off, including extrapolation outside the grid. On the standard parity grid (origin (100, 500), 2x3 pixels):
   
   | query | SedonaDB | Sedona Spark |
   |---|---|---|
   | `RS_RasterToWorldCoordX(rast, 1, 1)` | 102 | 100 |
   | `RS_RasterToWorldCoordY(rast, 1, 1)` | 497 | 500 |
   | `RS_WorldToRasterCoordX(rast, 100, 500)` | 0 | 1 |
   | `RS_WorldToRasterCoordY(rast, 100, 500)` | 0 | 1 |
   | `RS_WorldToRasterCoordX(rast, 90, 505)` | -5 | -4 |
   
   Meanwhile `RS_PixelAsPoint`/`Centroid`/`Polygon` are **1-based in both engines** (`RS_PixelAsPoint(rast, 1, 1)` → `POINT (100 500)` on both) — so SedonaDB is also internally inconsistent between its coordinate mappers and its pixel-geometry functions. Neither kernel documents a basis choice (`rs_rastercoordinate.rs`, `rs_worldcoordinate.rs`).
   
   Surfaced by the `integration/spark-parity` suite; the coordinate-mapper modules xfail-catalog this divergence referencing this issue. Proposal: align the mappers to 1-based (Spark/PostGIS convention, and consistent with `RS_PixelAs*`), or document 0-basing loudly if it is deliberate.
   


-- 
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_RasterToWorldCoord*/RS_WorldToRasterCoord* are 0-based; Sedona Spark, PostGIS, and RS_PixelAs* are 1-based [sedona-db]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on issue #1235:
URL: https://github.com/apache/sedona-db/issues/1235#issuecomment-5546329276

   > Proposal: align the mappers to 1-based (Spark/PostGIS convention, and consistent with RS_PixelAs*), or document 0-basing loudly if it is deliberate.
   
   1-basing seems fine for consistency although confusing (do any other tools deal with pixel indices in this way?). I thought there was an x/y ordering thing...does this ordering match the other PostGIS/Sedona overloads?)


-- 
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: [I] RS_RasterToWorldCoord*/RS_WorldToRasterCoord* are 0-based; Sedona Spark, PostGIS, and RS_PixelAs* are 1-based [sedona-db]

Posted by "james-willis (via GitHub)" <gi...@apache.org>.
james-willis closed issue #1235: RS_RasterToWorldCoord*/RS_WorldToRasterCoord* are 0-based; Sedona Spark, PostGIS, and RS_PixelAs* are 1-based
URL: https://github.com/apache/sedona-db/issues/1235


-- 
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: [I] RS_RasterToWorldCoord*/RS_WorldToRasterCoord* are 0-based; Sedona Spark, PostGIS, and RS_PixelAs* are 1-based [sedona-db]

Posted by "james-willis (via GitHub)" <gi...@apache.org>.
james-willis commented on issue #1235:
URL: https://github.com/apache/sedona-db/issues/1235#issuecomment-5546439346

   IIRC sedona does XY because Postgis does XY. as youve pointed out in the past, other systems like xarray use yx. I think 0 vs 1 indexing is orthogonal to XY YX order.


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