Skip to content

Conversation

@jesspav
Copy link
Collaborator

@jesspav jesspav commented Nov 28, 2025

Adds raster to world coordinate functions for x and y coordinates.

Example run

> SELECT rs_rastertoworldcoordy(rs_example(), 0, 1);
┌────────────────────────────────────────────────────────┐
│ rs_rastertoworldcoordy(rs_example(),Int64(0),Int64(1)) │
│                         float64                        │
╞════════════════════════════════════════════════════════╡
│                                                  81.07 │
└────────────────────────────────────────────────────────┘

1 row(s)/1 column(s) fetched. 
Elapsed 0.006 seconds.

> SELECT rs_rastertoworldcoordx(rs_example(), 0, 1);
┌────────────────────────────────────────────────────────┐
│ rs_rastertoworldcoordx(rs_example(),Int64(0),Int64(1)) │
│                         float64                        │
╞════════════════════════════════════════════════════════╡
│                                                  44.08 │
└────────────────────────────────────────────────────────┘

Bench

45% improvement through inlining.

Benchmarking native-raster-rs_rastertoworldcoordx-ArrayScalarScalar(Raster(64, 64), Int32(0, 63), Int32(0, 63)): Warming up for 3
Benchmarking native-raster-rs_rastertoworldcoordx-ArrayScalarScalar(Raster(64, 64), Int32(0, 63), Int32(0, 63)): Collecting 100 s
native-raster-rs_rastertoworldcoordx-ArrayScalarScalar(Raster(64, 64), Int32(0, 63), Int32(0, 63))
                        time:   [848.74 µs 849.79 µs 850.81 µs]
                        change: [-0.3373% +0.0026% +0.3306%] (p = 0.99 > 0.05)
                        No change in performance detected.
Found 7 outliers among 100 measurements (7.00%)
  5 (5.00%) low mild
  1 (1.00%) high mild
  1 (1.00%) high severe

Benchmarking native-raster-rs_rastertoworldcoordy-ArrayScalarScalar(Raster(64, 64), Int32(0, 63), Int32(0, 63)): Warming up for 3
Benchmarking native-raster-rs_rastertoworldcoordy-ArrayScalarScalar(Raster(64, 64), Int32(0, 63), Int32(0, 63)): Collecting 100 s
native-raster-rs_rastertoworldcoordy-ArrayScalarScalar(Raster(64, 64), Int32(0, 63), Int32(0, 63))
                        time:   [880.09 µs 885.23 µs 893.58 µs]
                        change: [-0.2444% +0.2830% +0.8483%] (p = 0.32 > 0.05)
                        No change in performance detected.
Found 5 outliers among 100 measurements (5.00%)
  4 (4.00%) low mild
  1 (1.00%) high severe

@jesspav jesspav requested a review from Copilot November 28, 2025 19:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds two new raster functions (RS_RasterToWorldCoordX and RS_RasterToWorldCoordY) that convert pixel/raster coordinates to world coordinates using affine transformations.

Key changes:

  • Implements affine transformation logic for coordinate conversion
  • Adds two new scalar UDFs for X and Y coordinate transformation
  • Extends benchmark infrastructure to support integer range arguments

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
rust/sedona-raster/src/lib.rs Exports new affine_transformation module
rust/sedona-raster/src/affine_transformation.rs Core affine transformation implementation with coordinate conversion logic
rust/sedona-raster-functions/src/rs_worldcoordinate.rs Implements RS_RasterToWorldCoordX and RS_RasterToWorldCoordY UDFs
rust/sedona-raster-functions/src/register.rs Registers new coordinate transformation functions
rust/sedona-raster-functions/src/lib.rs Exports rs_worldcoordinate module
rust/sedona-raster-functions/benches/native-raster-functions.rs Adds benchmarks for new coordinate functions
rust/sedona-testing/src/benchmark_util.rs Adds Int32 argument spec support for benchmarking

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jesspav jesspav marked this pull request as ready for review November 28, 2025 21:34
@jesspav jesspav requested a review from paleolimbot November 28, 2025 21:41
Copy link
Member

@paleolimbot paleolimbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Just curious: Is there also a RS_RasterToWorldCoord() that returns a Geometry?

@paleolimbot paleolimbot merged commit a3dcc12 into apache:main Dec 2, 2025
14 checks passed
pwrliang pushed a commit to pwrliang/sedona-db that referenced this pull request Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants