Skip to content

feat(rust/sedona-functions): Add item SRID support to geometry constructors#574

Open
paleolimbot wants to merge 5 commits intoapache:mainfrom
paleolimbot:item-crs-creators
Open

feat(rust/sedona-functions): Add item SRID support to geometry constructors#574
paleolimbot wants to merge 5 commits intoapache:mainfrom
paleolimbot:item-crs-creators

Conversation

@paleolimbot
Copy link
Member

@paleolimbot paleolimbot commented Feb 4, 2026

This PR:

  • Adds the extra "srid" argument support to ST_GeomFromWKB
  • Adds the ability to pass a column reference to any of ST_Point, ST_GeomFromWKT, or ST_GeomFromWKB (whereby the output becomes ItemCRS output)

Closes #126.

import pandas as pd
import sedona.db

sd = sedona.db.connect()
df = pd.DataFrame({"x": [1, 2, 3], "y": [4, 5, 6], "srid": [4326, 4326, 3857]})

sd.create_data_frame(df).to_view("df", overwrite=True)
sd.sql("SELECT ST_Point(x, y, srid) as geom FROM df").show()
# > ┌────────────────────────────────────┐
# > │                geom                │
# > │               struct               │
# > ╞════════════════════════════════════╡
# > │ {item: POINT(1 4), crs: OGC:CRS84} │
# > ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
# > │ {item: POINT(2 5), crs: OGC:CRS84} │
# > ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
# > │ {item: POINT(3 6), crs: EPSG:3857} │
# > └────────────────────────────────────┘

sd.sql(
    """
    SELECT ST_GeomFromWKB(
        ST_AsBinary(ST_GeomFromWKT('POINT (0 1)')),
        3857
    ) as geom
    """
).schema
#> SedonaSchema with 1 field:
#>   geom: geometry<WkbView(epsg:3857)>

@paleolimbot paleolimbot requested a review from Copilot February 4, 2026 19:39
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 support for item-level SRID (Spatial Reference System Identifier) to geometry constructor functions in the Rust implementation. The changes enable passing CRS information as a column reference instead of a scalar value, resulting in per-item CRS output.

Changes:

  • Modified ST_GeomFromWKB to accept an optional SRID argument
  • Updated SRIDifiedKernel to handle both scalar and column CRS inputs
  • Added test coverage for array CRS functionality across ST_Point, ST_GeomFromWKT, and ST_GeomFromWKB

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
rust/sedona-functions/src/st_setsrid.rs Enhanced SRIDifiedKernel to support column-level CRS arguments and implement item CRS output
rust/sedona-functions/src/st_point.rs Added test case for ST_Point with array CRS input
rust/sedona-functions/src/st_geomfromwkt.rs Added test case for ST_GeomFromWKT with array CRS input
rust/sedona-functions/src/st_geomfromwkb.rs Integrated SRIDifiedKernel and added test case for array CRS input

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

@paleolimbot paleolimbot marked this pull request as ready for review February 4, 2026 19:54
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.

rust/sedona-functions: Add SRID argument to ST_Point, ST_GeomFromText, and ST_GeomFromWkb

1 participant