Skip to content

GeoPandas: add distributed sampling, point construction, and geometry serialization #3196

Description

@jiayuasu

Part of #2230.

Implement the following distributed GeoPandas APIs in one batch:

  • GeoSeries.sample_points
  • sedona.spark.geopandas.points_from_xy
  • GeoDataFrame.to_wkt
  • GeoDataFrame.to_wkb

The implementations should use native Spark/Sedona expressions and keep
geometry rows distributed. They must not collect data to the driver or use
Python row UDFs.

Expected behavior:

  • sample_points supports GeoPandas-compatible uniform sampling, scalar or
    distributed sample sizes where appropriate, deterministic seeded execution,
    nulls, empties, and supported geometry families.
  • points_from_xy constructs a distributed GeoSeries, supports optional Z
    coordinates and CRS metadata, preserves distributed indexes, and validates
    alignment consistently with the rest of the Sedona GeoPandas layer.
  • GeoDataFrame.to_wkt and GeoDataFrame.to_wkb convert every geometry-typed
    column while preserving non-geometry columns, indexes, column labels, nulls,
    and row distribution. to_wkb also supports hexadecimal output.
  • Spark Connect execution remains supported.

Add direct tests and GeoPandas parity tests covering named and duplicate
indexes, MultiIndex inputs where supported, null and empty geometries,
multiple geometry columns, CRS metadata, argument validation, and execution
plans without Python UDF nodes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions