Skip to content

Route ST_Transform and sd_order through the injected CRS engine - #1102

Merged
james-willis merged 4 commits into
apache:mainfrom
james-willis:jw/geometry-crs-engine
Aug 2, 2026
Merged

Route ST_Transform and sd_order through the injected CRS engine#1102
james-willis merged 4 commits into
apache:mainfrom
james-willis:jw/geometry-crs-engine

Conversation

@james-willis

Copy link
Copy Markdown
Contributor

Migrates the two geometry CRS functions (ST_Transform, sd_order) off the process-global PROJ engine and onto the SedonaOptions-injected CrsEngine, mirroring the raster functions. The SedonaOptions -> runtime engine extraction now lives in a with_crs_engine helper in sedona-proj (with a config-less fallback to LazyProjEngine) so it sits below sedona-proj in the crate graph. Part of #1082.

…ed CRS engine

Add a `with_crs_engine` helper in sedona-proj that resolves the CRS engine
from the `SedonaOptions` runtime when config options are present, falling
back to `LazyProjEngine` otherwise. This keeps the `SedonaOptions` -> runtime
engine extraction below sedona-proj in the crate graph so the geometry CRS
functions can honor an injected engine.

ST_Transform now passes its `config_options` through the helper instead of
calling the process-global PROJ engine directly. sd_order gains an
`invoke_batch_from_args` override so it can do the same. The
sedona-raster-functions `crs_utils::with_crs_engine` becomes a thin delegator
to the shared helper.
@github-actions
github-actions Bot requested a review from zhangfengcdt July 31, 2026 19:44

@paleolimbot paleolimbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like the benchmark needs config options for the tester as well, but when CI is green this looks great.

No need to do it here if you'd rather not, but I believe that these two functions can also move to sedona-functions now (and we can drop the datafusion dependencies of sedona-proj.

The ST_Transform benchmark reprojects (EPSG:4326 -> EPSG:3857), which now
needs a real CrsEngine on the tester since the default one errors. Add
scalar_with_crs_engine / invoke_scalar_with_crs_engine and use them from the
proj benchmark to inject LazyProjEngine, mirroring the reprojecting-function
tests. The existing scalar / invoke_scalar keep their signatures and delegate
with no engine.
…f sedona-proj

Relocate the ST_Transform and sd_order (OrderLngLat) CRS functions from
sedona-proj to sedona-functions, and move the SedonaOptions -> runtime CRS
engine resolution (with_crs_engine) into sedona-common, where its config-less
fallback is the erroring DefaultCrsEngine rather than the global PROJ engine.
The session registers LazyProjEngine as the default, so real invocations are
unaffected; reprojecting tests and the benchmark inject LazyProjEngine.

The concrete PROJ engine (ProjCrsEngine/LazyProjEngine/with_global_proj_engine)
stays in sedona-proj, which no longer hosts DataFusion UDFs and drops its
datafusion-expr, sedona-functions, sedona-expr, and arrow dependencies.
@james-willis
james-willis marked this pull request as ready for review August 1, 2026 19:21
@james-willis

Copy link
Copy Markdown
Contributor Author

I moved those functions.

@paleolimbot asked for a rereview because those changes are substantial.

@paleolimbot paleolimbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

Comment thread c/sedona-proj/Cargo.toml
@james-willis
james-willis merged commit 8e72ad6 into apache:main Aug 2, 2026
17 checks passed
@james-willis
james-willis deleted the jw/geometry-crs-engine branch August 2, 2026 18:46
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