You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sedona.apache.org by ji...@apache.org on 2026/07/30 01:52:39 UTC

(sedona) branch master updated: [GH-3204] GeoPandas: complete maximum-circle, dwithin-distance, and Voronoi-extent parity (#3209)

This is an automated email from the ASF dual-hosted git repository.

jiayuasu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git


The following commit(s) were added to refs/heads/master by this push:
     new 44c2b44bee3 [GH-3204] GeoPandas: complete maximum-circle, dwithin-distance, and Voronoi-extent parity (#3209)
44c2b44bee3 is described below

commit 44c2b44bee30e0f3adbbd8c305623f43cf32da0f
Author: Jia Yu <ji...@apache.org>
AuthorDate: Wed Jul 29 18:52:33 2026 -0700

    [GH-3204] GeoPandas: complete maximum-circle, dwithin-distance, and Voronoi-extent parity (#3209)
---
 .../java/org/apache/sedona/common/Functions.java   |  27 +-
 .../org/apache/sedona/common/FunctionsTest.java    |  32 ++
 .../ST_MaximumInscribedCircle.md                   |  11 +-
 python/sedona/spark/geopandas/base.py              |  77 ++-
 python/sedona/spark/geopandas/geoseries.py         | 629 ++++++++++++++++++++-
 python/sedona/spark/sql/st_functions.py            |  13 +-
 python/tests/geopandas/test_geoseries.py           | 496 ++++++++++++++++
 .../tests/geopandas/test_match_geopandas_series.py |  66 +++
 python/tests/sql/test_dataframe_api.py             |   8 +
 python/tests/sql/test_function.py                  |  29 +
 .../sql/sedona_sql/expressions/Functions.scala     |  38 +-
 .../sql/sedona_sql/expressions/st_functions.scala  |   4 +
 .../apache/sedona/sql/dataFrameAPITestScala.scala  |  14 +
 .../org/apache/sedona/sql/functionTestScala.scala  |  24 +
 14 files changed, 1423 insertions(+), 45 deletions(-)

diff --git a/common/src/main/java/org/apache/sedona/common/Functions.java b/common/src/main/java/org/apache/sedona/common/Functions.java
index fd4527a6792..e0932a01d45 100644
--- a/common/src/main/java/org/apache/sedona/common/Functions.java
+++ b/common/src/main/java/org/apache/sedona/common/Functions.java
@@ -1451,12 +1451,31 @@ public class Functions {
   }
 
   public static InscribedCircle maximumInscribedCircle(Geometry geometry) {
-    // Calculating the tolerance
+    return maximumInscribedCircle(geometry, defaultMaximumInscribedCircleTolerance(geometry));
+  }
+
+  private static double defaultMaximumInscribedCircleTolerance(Geometry geometry) {
     Envelope envelope = geometry.getEnvelopeInternal();
-    double width = envelope.getWidth(), height = envelope.getHeight(), size, tolerance;
-    size = Math.max(width, height);
-    tolerance = size / 1000.0;
+    double size = Math.max(envelope.getWidth(), envelope.getHeight());
+    return size / 1000.0;
+  }
 
+  public static InscribedCircle maximumInscribedCircle(Geometry geometry, double tolerance) {
+    if (Double.isNaN(tolerance)) {
+      return null;
+    }
+    // JTS requires a positive tolerance. A zero value requests the same
+    // geometry-dependent default used by GEOS and the one-argument overload.
+    if (tolerance == 0.0) {
+      tolerance = defaultMaximumInscribedCircleTolerance(geometry);
+    }
+    // A non-empty zero-extent geometry has no positive automatic tolerance.
+    // GEOS returns the coincident center and boundary point for this case,
+    // while JTS rejects a zero tolerance before evaluating the geometry.
+    if (tolerance == 0.0 && !geometry.isEmpty()) {
+      Point point = geometry.getFactory().createPoint(geometry.getCoordinate());
+      return new InscribedCircle(point, point.copy(), 0.0);
+    }
     Geometry center, nearest;
     double radius;
 
diff --git a/common/src/test/java/org/apache/sedona/common/FunctionsTest.java b/common/src/test/java/org/apache/sedona/common/FunctionsTest.java
index 807a1ffe9eb..cee08f7137c 100644
--- a/common/src/test/java/org/apache/sedona/common/FunctionsTest.java
+++ b/common/src/test/java/org/apache/sedona/common/FunctionsTest.java
@@ -5086,6 +5086,7 @@ public class FunctionsTest extends TestBase {
             Constructors.geomFromEWKT("POINT (61.64205411585366 104.55256764481707)"),
             45.18896951053177);
     assertEquals(expected, actual);
+    assertNull(Functions.maximumInscribedCircle(geom, Double.NaN));
 
     geom =
         Constructors.geomFromEWKT(
@@ -5128,6 +5129,37 @@ public class FunctionsTest extends TestBase {
             Constructors.geomFromEWKT("POINT (67.4 14.8)"),
             2.2681911662992174);
     assertTrue(expected.equals(actual));
+
+    geom = Constructors.geomFromWKT("POLYGON ((0 0, 1 0, 1 1, 0 0))", 3857);
+    actual = Functions.maximumInscribedCircle(geom, 2.0);
+    expected =
+        new InscribedCircle(
+            Constructors.geomFromWKT("POINT (0.75 0.5)", 3857),
+            Constructors.geomFromWKT("POINT (0.625 0.625)", 3857),
+            0.1767766952966369);
+    assertEquals(expected, actual);
+    assertEquals(3857, actual.center.getSRID());
+    assertEquals(3857, actual.nearest.getSRID());
+    assertEquals(
+        Functions.maximumInscribedCircle(geom), Functions.maximumInscribedCircle(geom, 0.0));
+
+    geom = Constructors.geomFromWKT("POLYGON ((0 0, 0 0, 0 0, 0 0))", 3857);
+    actual = Functions.maximumInscribedCircle(geom);
+    expected =
+        new InscribedCircle(
+            Constructors.geomFromWKT("POINT (0 0)", 3857),
+            Constructors.geomFromWKT("POINT (0 0)", 3857),
+            0.0);
+    assertEquals(expected, actual);
+    assertEquals(expected, Functions.maximumInscribedCircle(geom, 0.0));
+    assertEquals(expected, Functions.maximumInscribedCircle(geom, 2.0));
+
+    Geometry finalGeom = geom;
+    IllegalArgumentException error =
+        assertThrows(
+            IllegalArgumentException.class,
+            () -> Functions.maximumInscribedCircle(finalGeom, -1.0));
+    assertEquals("Tolerance must be positive", error.getMessage());
   }
 
   @Test
diff --git a/docs/api/sql/Geometry-Processing/ST_MaximumInscribedCircle.md b/docs/api/sql/Geometry-Processing/ST_MaximumInscribedCircle.md
index 4bf63394706..7b23519e7f8 100644
--- a/docs/api/sql/Geometry-Processing/ST_MaximumInscribedCircle.md
+++ b/docs/api/sql/Geometry-Processing/ST_MaximumInscribedCircle.md
@@ -29,7 +29,16 @@ Introduction: Finds the largest circle that is contained within a (multi)polygon
 
 For polygonal geometries, the function inscribes the circle within the boundary rings, treating internal rings as additional constraints. When processing linear and point inputs, the algorithm inscribes the circle within the convex hull of the input, utilizing the input lines and points as additional boundary constraints.
 
-Format: `ST_MaximumInscribedCircle(geometry: Geometry)`
+Formats:
+
+- `ST_MaximumInscribedCircle(geometry: Geometry)`
+- `ST_MaximumInscribedCircle(geometry: Geometry, tolerance: Double)`
+
+The optional `tolerance` controls when the circle-center search stops
+refining. A value of `0` uses the geometry-dependent default
+`max(width, height) / 1000`, which is also used by the one-argument form.
+The tolerance must otherwise be positive.
+The two-argument overload was added in `v1.9.1`.
 
 Return type: `Struct<center: Geometry, nearest: Geometry, radius: Double>`
 
diff --git a/python/sedona/spark/geopandas/base.py b/python/sedona/spark/geopandas/base.py
index a4272fae7b6..db20cee5a0e 100644
--- a/python/sedona/spark/geopandas/base.py
+++ b/python/sedona/spark/geopandas/base.py
@@ -1047,8 +1047,9 @@ class GeoFrame(metaclass=ABCMeta):
         tolerance : float, default 0.0
             Snapping tolerance for vertices to be considered equal.
         extend_to : Geometry, default None
-            Not supported. Passing a non-None value will raise
-            ``NotImplementedError``.
+            A local geometry whose envelope enlarges the default extent of
+            every row's Voronoi diagram. Distributed and array-like extents
+            are not supported.
         only_edges : bool, default False
             Only ``only_edges=False`` is supported. Passing ``only_edges=True``
             will raise ``NotImplementedError``.
@@ -1360,6 +1361,60 @@ class GeoFrame(metaclass=ABCMeta):
         """
         return _delegate_to_geometry_column("minimum_bounding_circle", self)
 
+    def maximum_inscribed_circle(self, *, tolerance=None):
+        """Return radius lines for the largest circles within polygonal geometries.
+
+        Each result is a two-point LineString from the circle center to the
+        nearest point on the polygon boundary. Polygon, MultiPolygon, and
+        ``None`` inputs are supported; other geometry types and empty
+        polygonal geometries raise an error only when an action evaluates an
+        affected row. Partial actions may not inspect every invalid row.
+
+        Parameters
+        ----------
+        tolerance : float, array-like, pandas Series, or pandas-on-Spark Series, optional
+            Stop refining when the search area is smaller than this distance.
+            By default, each geometry uses
+            ``max(width, height) / 1000``. A one-value local array-like is
+            broadcast; otherwise it must have the same length as the
+            GeoSeries. A pandas Series must also have the same index. A
+            distributed Series must share the same frame and index as the
+            geometry column. Negative values are rejected for scalar and
+            row-wise inputs. This is intentionally stricter than GeoPandas,
+            whose array path currently bypasses its scalar negative-value
+            validation and emits implementation-dependent results. Length and
+            index validation for local row-wise inputs is also lazy: an error
+            is raised only when an action evaluates a mismatched row.
+
+        Returns
+        -------
+        GeoSeries
+
+        Examples
+        --------
+        >>> from sedona.spark.geopandas import GeoSeries
+        >>> from shapely.geometry import Polygon
+        >>> s = GeoSeries(
+        ...     [
+        ...         Polygon([(0, 0), (1, 0), (1, 1), (0, 0)]),
+        ...         Polygon([(0, 0), (0.5, -1), (1, 0), (1, 1), (-0.5, 0.5)]),
+        ...     ]
+        ... )
+        >>> s.maximum_inscribed_circle()
+        0    LINESTRING (0.70703 0.29297, 0.5 0.5)
+        1    LINESTRING (0.4668 0.25977, 1 0.25977)
+        dtype: geometry
+
+        See Also
+        --------
+        GeoSeries.minimum_bounding_circle : minimum enclosing circle geometry
+        """
+        return _delegate_to_geometry_column(
+            "maximum_inscribed_circle",
+            self,
+            tolerance=tolerance,
+        )
+
     def minimum_bounding_radius(self):
         """Return a `Series` of the radii of the minimum bounding circles
         that enclose each geometry.
@@ -3770,11 +3825,13 @@ class GeoFrame(metaclass=ABCMeta):
         other : GeoSeries or geometric object
             The GeoSeries (elementwise) or geometric object to test for
             equality.
-        distance : float, np.array, pd.Series
-            Distance(s) to test if each geometry is within. A scalar distance will be
-            applied to all geometries. An array or Series will be applied elementwise.
-            If np.array or pd.Series are used then it must have same length as the
-            GeoSeries.
+        distance : numeric scalar, array-like, pandas Series, or pandas-on-Spark Series
+            Distance(s) to test if each geometry is within. A scalar distance
+            is applied to every geometry. Array-like and Series distances are
+            paired positionally with the geometry rows after ``self`` and
+            ``other`` have been aligned. A one-element non-Series array-like is
+            broadcast; otherwise the distance input must have the same length
+            as the aligned geometries.
         align : bool | None (default None)
             If True, automatically aligns GeoSeries based on their indices.
             If False, the order of elements is preserved. None defaults to True.
@@ -3857,6 +3914,12 @@ class GeoFrame(metaclass=ABCMeta):
         This method works in a row-wise manner. It does not check if an element
         of one GeoSeries is within the set distance of *any* element of the other one.
 
+        The index of a pandas or pandas-on-Spark distance Series is ignored.
+        Distance values remain distributed when a pandas-on-Spark Series is
+        provided. Length validation for non-scalar distances is lazy: an error
+        is raised only when an action evaluates a mismatched row. Partial
+        actions may not detect rows they do not evaluate.
+
         See also
         --------
         GeoSeries.within
diff --git a/python/sedona/spark/geopandas/geoseries.py b/python/sedona/spark/geopandas/geoseries.py
index f01414b5108..9afc2cf5333 100644
--- a/python/sedona/spark/geopandas/geoseries.py
+++ b/python/sedona/spark/geopandas/geoseries.py
@@ -34,6 +34,8 @@ from pyspark.pandas.series import first_series
 from pyspark.pandas.utils import same_anchor, scol_for, verify_temp_column_name
 from pyspark.sql.types import (
     BooleanType,
+    DoubleType,
+    FloatType,
     IntegralType,
     LongType,
     NullType,
@@ -129,6 +131,59 @@ def _normalize_numeric_scalar(value, error_message: str) -> float:
         raise TypeError(error_message) from exc
 
 
+def _is_dwithin_numeric_scalar(value) -> bool:
+    """Return whether Shapely treats a distance value as a numeric scalar."""
+    if isinstance(value, np.ndarray):
+        return value.ndim == 0 and value.dtype.kind in "biuf"
+    return isinstance(
+        value,
+        (bool, int, float, np.bool_, np.integer, np.floating),
+    )
+
+
+def _normalize_dwithin_numeric_scalar(value) -> float:
+    """Normalize one dwithin threshold to the SQL engine's double type."""
+    if not _is_dwithin_numeric_scalar(value):
+        raise TypeError(
+            "'distance' must be a numeric scalar or a one-dimensional "
+            "numeric array-like"
+        )
+    try:
+        return float(value)
+    except (TypeError, ValueError, OverflowError) as exc:
+        raise TypeError(
+            "'distance' must be a numeric scalar or a one-dimensional "
+            "numeric array-like"
+        ) from exc
+
+
+def _normalize_dwithin_distance_sequence(distance) -> List[float]:
+    """Materialize and validate a local one-dimensional distance sequence."""
+    if isinstance(distance, np.ndarray) and distance.ndim != 1:
+        raise ValueError("'distance' must be one-dimensional")
+    if isinstance(distance, (dict, set, frozenset)):
+        raise TypeError("'distance' must be an ordered numeric array-like")
+    try:
+        values = list(distance)
+    except TypeError as exc:
+        raise TypeError(
+            "'distance' must be a numeric scalar or a one-dimensional "
+            "numeric array-like"
+        ) from exc
+
+    return [_normalize_dwithin_numeric_scalar(value) for value in values]
+
+
+def _normalize_circle_tolerance_scalar(value, error_message: str) -> float:
+    """Normalize the scalar types accepted by Shapely's tolerance ufunc."""
+    if not isinstance(
+        value,
+        (bool, int, float, np.bool_, np.integer, np.floating),
+    ):
+        raise TypeError(error_message)
+    return float(value)
+
+
 def _normalize_affine_scalar(value, error_message: str) -> float:
     """Normalize an operation-wide affine parameter to a Python float."""
     return _normalize_numeric_scalar(value, error_message)
@@ -173,6 +228,35 @@ def _attach_ordered_sequence_column(
     )
 
 
+def _dwithin_expression(
+    left: PySparkColumn,
+    right: PySparkColumn,
+    distance: PySparkColumn,
+    invalid_distance_shape: PySparkColumn = None,
+) -> PySparkColumn:
+    """Build a null-safe native dwithin expression."""
+    geometry_is_missing_or_empty = (
+        left.isNull()
+        | right.isNull()
+        | F.coalesce(stf.ST_IsEmpty(left), F.lit(False))
+        | F.coalesce(stf.ST_IsEmpty(right), F.lit(False))
+    )
+    result = F.when(geometry_is_missing_or_empty, F.lit(False)).otherwise(
+        F.coalesce(stp.ST_DWithin(left, right, distance), F.lit(False))
+    )
+    if invalid_distance_shape is not None:
+        result = F.when(
+            invalid_distance_shape,
+            F.raise_error(
+                F.lit(
+                    "The distance array must contain one value per geometry "
+                    "after alignment."
+                )
+            ).cast("boolean"),
+        ).otherwise(result)
+    return result
+
+
 def _sample_points_expression(
     geometry: PySparkColumn,
     size: PySparkColumn,
@@ -232,6 +316,55 @@ def _sample_points_expression(
     )
 
 
+def _maximum_inscribed_circle_expression(
+    geometry: PySparkColumn,
+    tolerance: typing.Optional[PySparkColumn],
+) -> PySparkColumn:
+    """Build GeoPandas-compatible maximum-inscribed-circle expressions."""
+    geometry_type = stf.ST_GeometryType(geometry)
+    is_polygonal = geometry_type.isin("ST_Polygon", "ST_MultiPolygon")
+    # Derive a typed NULL from the input so CASE branches retain GeometryType.
+    null_geometry = F.when(F.lit(False), geometry)
+
+    circle = (
+        stf.ST_MaximumInscribedCircle(geometry)
+        if tolerance is None
+        else stf.ST_MaximumInscribedCircle(geometry, tolerance)
+    )
+    # Extracting center and nearest directly from the same struct expression
+    # duplicates this expensive CodegenFallback operation. Bind the struct as
+    # a one-element array value so the circle search runs once per row.
+    radius_line = F.transform(
+        F.array(circle),
+        lambda result: stf.ST_MakeLine(
+            result.getField("center"),
+            result.getField("nearest"),
+        ),
+    ).getItem(0)
+
+    result = F.when(geometry.isNull(), null_geometry)
+    if tolerance is not None:
+        result = result.when(
+            tolerance.isNull() | F.isnan(tolerance),
+            null_geometry,
+        ).when(
+            tolerance < 0,
+            F.raise_error(F.lit("'tolerance' should be positive")),
+        )
+
+    return (
+        result.when(
+            ~is_polygonal,
+            F.raise_error(F.lit("Input geometry must be a Polygon or MultiPolygon")),
+        )
+        .when(
+            stf.ST_IsEmpty(geometry),
+            F.raise_error(F.lit("Empty input geometry is not supported")),
+        )
+        .otherwise(radius_line)
+    )
+
+
 def _interpret_origin(geometry: PySparkColumn, origin, with_z: bool):
     """Resolve a local affinity origin to distributed coordinate columns."""
     if isinstance(origin, str):
@@ -1199,22 +1332,212 @@ class GeoSeries(GeoFrame, pspd.Series):
         )
 
     def dwithin(self, other, distance, align=None):
-        if not isinstance(distance, (float, int)):
-            raise NotImplementedError(
-                "Array-like distance for dwithin not implemented yet."
+        attached_distance_column = None
+        if isinstance(other, BaseGeometry):
+            same_anchor_distance = isinstance(
+                distance, PandasOnSparkSeries
+            ) and same_anchor(self, distance)
+            # Keep the shared source plan when the distance Series comes from the
+            # same frame. A resolved copy of this GeoSeries projects away sibling
+            # columns before the distance expression can be selected.
+            source_internal = (
+                self._internal if same_anchor_distance else self._internal.resolved_copy
             )
+            source_frame = source_internal.spark_frame
+            result_index_columns = [
+                f"__index_level_{level}__"
+                for level in range(len(source_internal.index_spark_columns))
+            ]
+            other_geometry = stc.ST_GeomFromWKB(F.lit(other.wkb))
+            distance_columns = []
+            if same_anchor_distance:
+                distance_data_type = distance.spark.data_type
+                if not isinstance(
+                    distance_data_type,
+                    (BooleanType, IntegralType, FloatType, DoubleType),
+                ):
+                    raise TypeError("distance values must be numeric")
+                attached_distance_name = "__dwithin_same_anchor_distance__"
+                distance_columns.append(
+                    distance.spark.column.cast("double").alias(attached_distance_name)
+                )
+            aligned_frame = source_frame.select(
+                source_internal.data_spark_columns[0].alias("L"),
+                other_geometry.alias("R"),
+                *distance_columns,
+                *[
+                    index_col.alias(result_index)
+                    for index_col, result_index in zip(
+                        source_internal.index_spark_columns,
+                        result_index_columns,
+                    )
+                ],
+                scol_for(source_frame, NATURAL_ORDER_COLUMN_NAME),
+            )
+            if distance_columns:
+                attached_distance_column = scol_for(
+                    aligned_frame,
+                    attached_distance_name,
+                )
+            result_index_fields = source_internal.index_fields
+            result_index_names = source_internal.index_names
+        else:
+            if not isinstance(
+                other,
+                (
+                    GeoSeries,
+                    GeoDataFrame,
+                    PandasOnSparkSeries,
+                    list,
+                    np.ndarray,
+                ),
+            ):
+                raise TypeError(
+                    "'other' must be a GeoSeries, GeoDataFrame, "
+                    "pandas-on-Spark Series, geometry, list, or NumPy array"
+                )
 
-        other_series, extended = self._make_series_of_val(other)
-        align = False if extended else align
-
-        spark_expr = stp.ST_DWithin(F.col("L"), F.col("R"), F.lit(distance))
-        return self._row_wise_operation(
+            other_series, extended = self._make_series_of_val(other)
+            align = False if extended else align
+            (
+                aligned_frame,
+                result_index_columns,
+                result_index_fields,
+                result_index_names,
+            ) = self._align_binary_geometry_series(other_series, align)
+
+        if attached_distance_column is None:
+            (
+                result_frame,
+                distance_column,
+                invalid_distance_shape,
+            ) = self._attach_dwithin_distance(aligned_frame, distance)
+        else:
+            result_frame = aligned_frame
+            distance_column = attached_distance_column
+            invalid_distance_shape = None
+        spark_expr = _dwithin_expression(
+            F.col("L"),
+            F.col("R"),
+            distance_column,
+            invalid_distance_shape,
+        )
+        result = self._boolean_result_preserving_index(
             spark_expr,
-            other_series,
-            align=align,
-            returns_geom=False,
-            default_val=False,
+            result_frame,
+            [scol_for(result_frame, name) for name in result_index_columns],
+            result_index_fields,
+            result_index_names,
+        )
+        return _to_bool(result)
+
+    def _attach_dwithin_distance(self, aligned_frame, distance):
+        """Attach a distance array to already-aligned geometry rows by position."""
+        if _is_dwithin_numeric_scalar(distance):
+            return (
+                aligned_frame,
+                F.lit(_normalize_dwithin_numeric_scalar(distance)),
+                None,
+            )
+
+        distance_is_series = isinstance(distance, (pd.Series, PandasOnSparkSeries))
+        if isinstance(distance, PandasOnSparkSeries):
+            distance_data_type = distance.spark.data_type
+            if not isinstance(
+                distance_data_type,
+                (BooleanType, IntegralType, FloatType, DoubleType),
+            ):
+                raise TypeError("distance values must be numeric")
+            local_distances = None
+        else:
+            if not pd.api.types.is_list_like(distance):
+                raise TypeError(
+                    "'distance' must be a numeric scalar or a one-dimensional "
+                    "numeric array-like"
+                )
+            local_distances = _normalize_dwithin_distance_sequence(distance)
+            if len(local_distances) == 1 and not distance_is_series:
+                return aligned_frame, F.lit(local_distances[0]), None
+
+        position_col = "__dwithin_position__"
+        geometry_present_col = "__dwithin_geometry_present__"
+        distance_value_col = "__dwithin_distance__"
+        distance_present_col = "__dwithin_distance_present__"
+
+        geometry_with_position = _attach_ordered_sequence_column(
+            aligned_frame,
+            scol_for(aligned_frame, NATURAL_ORDER_COLUMN_NAME),
+            position_col,
         )
+        geometry_frame = geometry_with_position.select(
+            *[
+                scol_for(geometry_with_position, name)
+                for name in aligned_frame.columns
+                if name != NATURAL_ORDER_COLUMN_NAME
+            ],
+            scol_for(geometry_with_position, position_col),
+            F.lit(True).alias(geometry_present_col),
+        )
+
+        if isinstance(distance, PandasOnSparkSeries):
+            distance_internal = distance._internal.resolved_copy
+            distance_source = distance_internal.spark_frame
+            distance_order_col = "__dwithin_distance_order__"
+            distance_frame = distance_source.select(
+                distance_internal.data_spark_columns[0]
+                .cast("double")
+                .alias(distance_value_col),
+                scol_for(distance_source, NATURAL_ORDER_COLUMN_NAME).alias(
+                    distance_order_col
+                ),
+                F.lit(True).alias(distance_present_col),
+            )
+            distance_frame = _attach_ordered_sequence_column(
+                distance_frame,
+                F.col(distance_order_col),
+                position_col,
+            ).select(
+                F.col(position_col),
+                F.col(distance_value_col),
+                F.col(distance_present_col),
+            )
+        else:
+            distance_schema = StructType(
+                [
+                    StructField(position_col, LongType(), nullable=False),
+                    StructField(distance_value_col, DoubleType(), nullable=True),
+                    StructField(distance_present_col, BooleanType(), nullable=False),
+                ]
+            )
+            distance_rows = [
+                (position, distance_value, True)
+                for position, distance_value in enumerate(local_distances)
+            ]
+            distance_frame = aligned_frame.sparkSession.createDataFrame(
+                distance_rows,
+                schema=distance_schema,
+            )
+
+        joined_frame = geometry_frame.join(
+            distance_frame,
+            on=position_col,
+            how="full",
+        ).orderBy(position_col)
+        result_frame = joined_frame.select(
+            *[
+                F.col(name)
+                for name in aligned_frame.columns
+                if name != NATURAL_ORDER_COLUMN_NAME
+            ],
+            F.col(distance_value_col),
+            F.col(geometry_present_col),
+            F.col(distance_present_col),
+            F.col(position_col).alias(NATURAL_ORDER_COLUMN_NAME),
+        )
+        invalid_distance_shape = (
+            F.col(geometry_present_col).isNull() | F.col(distance_present_col).isNull()
+        )
+        return result_frame, F.col(distance_value_col), invalid_distance_shape
 
     def clip_by_rect(self, xmin, ymin, xmax, ymax) -> "GeoSeries":
         if not all(
@@ -1442,11 +1765,36 @@ class GeoSeries(GeoFrame, pspd.Series):
             raise NotImplementedError(
                 "Sedona does not support only_edges=True for voronoi_polygons."
             )
-        if extend_to is not None:
-            raise NotImplementedError(
-                "Sedona does not support extend_to for voronoi_polygons."
+        if extend_to is None:
+            spark_expr = stf.ST_VoronoiPolygons(self.spark.column, tolerance, extend_to)
+            return self._query_geometry_column(
+                spark_expr,
+                returns_geom=True,
             )
-        spark_expr = stf.ST_VoronoiPolygons(self.spark.column, tolerance, extend_to)
+        if not isinstance(extend_to, BaseGeometry):
+            raise TypeError("'extend_to' must be a geometry or None")
+
+        geometry = self.spark.column
+        source_envelope = stf.ST_Envelope(geometry)
+        # Bind the source envelope once so its bounds are not recomputed from
+        # the full input geometry for every coordinate accessor.
+        default_extent = F.transform(
+            F.array(source_envelope),
+            lambda envelope: stf.ST_Expand(
+                envelope,
+                F.greatest(
+                    stf.ST_XMax(envelope) - stf.ST_XMin(envelope),
+                    stf.ST_YMax(envelope) - stf.ST_YMin(envelope),
+                ),
+            ),
+        ).getItem(0)
+        requested_extent = stc.ST_GeomFromWKB(F.lit(extend_to.envelope.wkb))
+        # JTS treats extendTo as a hard clip. GeoPandas only enlarges the
+        # default Voronoi extent, so combine both envelopes before calling it.
+        effective_extent = stf.ST_Envelope(
+            stf.ST_Collect(F.array(default_extent, requested_extent))
+        )
+        spark_expr = stf.ST_VoronoiPolygons(geometry, tolerance, effective_extent)
         return self._query_geometry_column(
             spark_expr,
             returns_geom=True,
@@ -1542,6 +1890,213 @@ class GeoSeries(GeoFrame, pspd.Series):
             returns_geom=True,
         )
 
+    def maximum_inscribed_circle(self, *, tolerance=None) -> "GeoSeries":
+        tolerance_error = (
+            "tolerance must be a numeric scalar, array-like, pandas Series, "
+            "or same-frame pandas-on-Spark Series"
+        )
+        tolerance_column = None
+        if isinstance(tolerance, PandasOnSparkSeries):
+            if not same_anchor(self, tolerance):
+                raise ValueError(
+                    "A distributed tolerance Series must share the same frame "
+                    "and index as the GeoSeries; align both columns in one "
+                    "DataFrame before calling maximum_inscribed_circle"
+                )
+            spark_type = tolerance.spark.data_type
+            if not isinstance(
+                spark_type,
+                (BooleanType, IntegralType, FloatType, DoubleType, NullType),
+            ):
+                raise TypeError(tolerance_error)
+            tolerance_column = tolerance.spark.column.cast("double")
+        elif isinstance(tolerance, pd.Series) or (
+            tolerance is not None and pd.api.types.is_list_like(tolerance)
+        ):
+            return self._maximum_inscribed_circle_with_local_tolerance(
+                tolerance,
+                tolerance_error,
+            )
+        elif tolerance is not None:
+            if isinstance(tolerance, np.ndarray) and tolerance.ndim == 0:
+                tolerance = tolerance.item()
+            normalized_tolerance = _normalize_circle_tolerance_scalar(
+                tolerance,
+                tolerance_error,
+            )
+            if normalized_tolerance < 0:
+                raise ValueError("'tolerance' should be positive")
+            tolerance_column = F.lit(normalized_tolerance)
+
+        spark_expr = _maximum_inscribed_circle_expression(
+            self.spark.column,
+            tolerance_column,
+        )
+        return self._query_geometry_column(
+            spark_expr,
+            returns_geom=True,
+        )
+
+    def _maximum_inscribed_circle_with_local_tolerance(
+        self,
+        tolerance,
+        tolerance_error: str,
+    ) -> "GeoSeries":
+        """Positionally align a local tolerance vector without collecting rows."""
+        normalized_values = None
+        if not isinstance(tolerance, pd.Series):
+            normalized_values = [
+                _normalize_circle_tolerance_scalar(value, tolerance_error)
+                for value in list(tolerance)
+            ]
+            if len(normalized_values) == 1:
+                spark_expr = _maximum_inscribed_circle_expression(
+                    self.spark.column,
+                    F.lit(normalized_values[0]),
+                )
+                return self._query_geometry_column(
+                    spark_expr,
+                    returns_geom=True,
+                )
+
+        source_internal = self._internal.resolved_copy
+        source_sdf = source_internal.spark_frame
+        reserved_names = set(source_sdf.columns)
+
+        def temp_column_name(base: str) -> str:
+            suffix = 0
+            candidate = f"__maximum_inscribed_circle_{base}__"
+            while candidate in reserved_names:
+                suffix += 1
+                candidate = f"__maximum_inscribed_circle_{base}_{suffix}__"
+            reserved_names.add(candidate)
+            return typing.cast(
+                str,
+                verify_temp_column_name(source_sdf, candidate),
+            )
+
+        geometry_col = temp_column_name("geometry")
+        tolerance_col = temp_column_name("tolerance")
+        position_col = temp_column_name("position")
+        left_present_col = temp_column_name("left_present")
+        right_present_col = temp_column_name("right_present")
+        left_order_col = temp_column_name("left_order")
+
+        left_frame = source_sdf.select(
+            source_internal.data_spark_columns[0].alias(geometry_col),
+            *[
+                scol_for(source_sdf, name)
+                for name in source_internal.index_spark_column_names
+            ],
+            scol_for(source_sdf, NATURAL_ORDER_COLUMN_NAME).alias(left_order_col),
+            F.lit(True).alias(left_present_col),
+        )
+        left_frame = _attach_ordered_sequence_column(
+            left_frame,
+            F.col(left_order_col),
+            position_col,
+        ).withColumnRenamed(left_order_col, NATURAL_ORDER_COLUMN_NAME)
+
+        if isinstance(tolerance, pd.Series):
+            if not (
+                pd.api.types.is_bool_dtype(tolerance.dtype)
+                or pd.api.types.is_integer_dtype(tolerance.dtype)
+                or pd.api.types.is_float_dtype(tolerance.dtype)
+            ):
+                raise TypeError(tolerance_error)
+
+            local_series = pspd.Series(tolerance)
+            right_internal = local_series._internal.resolved_copy
+            right_sdf = right_internal.spark_frame
+            right_order_col = temp_column_name("right_order")
+            right_index_cols = [
+                temp_column_name(f"right_index_{level}")
+                for level in range(len(right_internal.index_spark_column_names))
+            ]
+            right_frame = right_sdf.select(
+                right_internal.data_spark_columns[0]
+                .cast("double")
+                .alias(tolerance_col),
+                *[
+                    scol_for(right_sdf, name).alias(alias)
+                    for name, alias in zip(
+                        right_internal.index_spark_column_names,
+                        right_index_cols,
+                    )
+                ],
+                scol_for(right_sdf, NATURAL_ORDER_COLUMN_NAME).alias(right_order_col),
+                F.lit(True).alias(right_present_col),
+            )
+            right_frame = _attach_ordered_sequence_column(
+                right_frame,
+                F.col(right_order_col),
+                position_col,
+            )
+
+            if len(right_index_cols) == len(source_internal.index_spark_column_names):
+                index_mismatch = F.lit(False)
+                for left_index, right_index in zip(
+                    source_internal.index_spark_column_names,
+                    right_index_cols,
+                ):
+                    index_mismatch = index_mismatch | ~F.col(left_index).eqNullSafe(
+                        F.col(right_index)
+                    )
+            else:
+                index_mismatch = F.lit(True)
+        else:
+            right_schema = StructType(
+                [
+                    StructField(position_col, LongType(), nullable=False),
+                    StructField(tolerance_col, DoubleType(), nullable=False),
+                    StructField(right_present_col, BooleanType(), nullable=False),
+                ]
+            )
+            right_frame = source_sdf.sparkSession.createDataFrame(
+                [
+                    (position, value, True)
+                    for position, value in enumerate(normalized_values)
+                ],
+                schema=right_schema,
+            )
+            index_mismatch = F.lit(False)
+
+        aligned_frame = left_frame.join(
+            right_frame,
+            on=position_col,
+            how="full",
+        ).orderBy(position_col)
+        length_mismatch = (
+            F.col(left_present_col).isNull() | F.col(right_present_col).isNull()
+        )
+        radius_line = _maximum_inscribed_circle_expression(
+            F.col(geometry_col),
+            F.col(tolerance_col),
+        )
+        spark_expr = (
+            F.when(
+                length_mismatch,
+                F.raise_error(
+                    F.lit("Length of tolerance does not match length of GeoSeries")
+                ),
+            )
+            .when(
+                index_mismatch,
+                F.raise_error(
+                    F.lit(
+                        "Index of the Series passed as 'tolerance' does not "
+                        "match index of the GeoSeries"
+                    )
+                ),
+            )
+            .otherwise(radius_line)
+        )
+        return self._query_geometry_column(
+            spark_expr,
+            aligned_frame,
+            returns_geom=True,
+        )
+
     def minimum_bounding_radius(self) -> pspd.Series:
         spark_struct = stf.ST_MinimumBoundingRadius(self.spark.column)
         spark_radius = spark_struct.getField("radius")
@@ -2534,25 +3089,24 @@ class GeoSeries(GeoFrame, pspd.Series):
         )
         return first_series(PandasOnSparkDataFrame(internal)).rename(None)
 
-    def _geom_equals_exact_series(
+    def _align_binary_geometry_series(
         self,
         other: pspd.Series,
-        tolerance: float,
         align: Union[bool, None],
-    ) -> pspd.Series:
-        """Execute exact equality with GeoPandas-compatible row alignment."""
-        position_col = "__geom_equals_exact_position__"
-        left_present_col = "__geom_equals_exact_left_present__"
-        right_present_col = "__geom_equals_exact_right_present__"
-        left_order_col = "__geom_equals_exact_left_order__"
-        right_order_col = "__geom_equals_exact_right_order__"
+    ):
+        """Align two geometry Series and preserve every resulting index level."""
+        position_col = "__binary_geometry_position__"
+        left_present_col = "__binary_geometry_left_present__"
+        right_present_col = "__binary_geometry_right_present__"
+        left_order_col = "__binary_geometry_left_order__"
+        right_order_col = "__binary_geometry_right_order__"
 
         left_index_aliases = [
-            f"__geom_equals_exact_left_index_{level}__"
+            f"__binary_geometry_left_index_{level}__"
             for level in range(len(self._internal.index_spark_columns))
         ]
         right_index_aliases = [
-            f"__geom_equals_exact_right_index_{level}__"
+            f"__binary_geometry_right_index_{level}__"
             for level in range(len(other._internal.index_spark_columns))
         ]
 
@@ -2861,6 +3415,27 @@ class GeoSeries(GeoFrame, pspd.Series):
                 for result_index in result_index_columns
             ]
 
+        return (
+            aligned_frame,
+            result_index_columns,
+            result_index_fields,
+            result_index_names,
+        )
+
+    def _geom_equals_exact_series(
+        self,
+        other: pspd.Series,
+        tolerance: float,
+        align: Union[bool, None],
+    ) -> pspd.Series:
+        """Execute exact equality with GeoPandas-compatible row alignment."""
+        (
+            aligned_frame,
+            result_index_columns,
+            result_index_fields,
+            result_index_names,
+        ) = self._align_binary_geometry_series(other, align)
+
         spark_expr = stp.ST_EqualsExact(F.col("L"), F.col("R"), tolerance)
         result = self._boolean_result_preserving_index(
             F.coalesce(spark_expr, F.lit(False)),
diff --git a/python/sedona/spark/sql/st_functions.py b/python/sedona/spark/sql/st_functions.py
index 1dc229bdb64..52227bddf5b 100644
--- a/python/sedona/spark/sql/st_functions.py
+++ b/python/sedona/spark/sql/st_functions.py
@@ -1660,15 +1660,22 @@ def ST_MakeValid(
 
 
 @validate_argument_types
-def ST_MaximumInscribedCircle(geometry: ColumnOrName) -> Column:
+def ST_MaximumInscribedCircle(
+    geometry: ColumnOrName,
+    tolerance: Optional[ColumnOrNameOrNumber] = None,
+) -> Column:
     """Finds the largest circle that is contained within a geometry, or which does not overlap any lines and points
 
-    :param geometry:
+    :param geometry: Input geometry column.
     :type geometry: ColumnOrName
+    :param tolerance: Optional search tolerance. Zero uses the per-geometry
+        default of ``max(width, height) / 1000``.
+    :type tolerance: Optional[ColumnOrNameOrNumber]
     :return: Row of center point, nearest point and radius
     :rtype: Column
     """
-    return _call_st_function("ST_MaximumInscribedCircle", geometry)
+    args = (geometry,) if tolerance is None else (geometry, tolerance)
+    return _call_st_function("ST_MaximumInscribedCircle", args)
 
 
 @validate_argument_types
diff --git a/python/tests/geopandas/test_geoseries.py b/python/tests/geopandas/test_geoseries.py
index 2cb0acccfde..cdfd2629ff2 100644
--- a/python/tests/geopandas/test_geoseries.py
+++ b/python/tests/geopandas/test_geoseries.py
@@ -15,6 +15,8 @@
 # specific language governing permissions and limitations
 # under the License.
 
+from decimal import Decimal
+
 import shapely
 import numpy as np
 import pytest
@@ -1107,6 +1109,7 @@ e": "Feature", "properties": {}, "geometry": {"type": "Point", "coordinates": [3
 
         result = s.dwithin(s2, distance=1, align=True)
         expected = pd.Series([False, True, False, False, False])
+        self.check_pd_series_equal(result, expected)
 
         result = s.dwithin(s2, distance=1, align=False)
         expected = pd.Series([True, False, False, True])
@@ -1116,6 +1119,211 @@ e": "Feature", "properties": {}, "geometry": {"type": "Point", "coordinates": [3
         df_result = s.to_geoframe().dwithin(s2, distance=1, align=False)
         self.check_pd_series_equal(df_result, expected)
 
+    def test_dwithin_array_like_distances(self):
+        index = pd.Index(["a", "b", "c"], name="feature_id")
+        source = GeoSeries(
+            [Point(0, 0), Point(2, 0), Point(5, 0)],
+            index=index,
+        )
+        expected = pd.Series([True, False, True], index=index)
+
+        distances = [
+            [0, 1, 5],
+            (0, 1, 5),
+            np.array([0, 1, 5]),
+            pd.Series([0, 1, 5], index=["unrelated-c", "unrelated-a", "unrelated-b"]),
+        ]
+        for distance in distances:
+            result = source.dwithin(Point(0, 0), distance)
+            self.check_pd_series_equal(result, expected)
+
+        broadcast_expected = pd.Series([True, True, False], index=index)
+        for distance in ([3], (3,), np.array([3]), np.array(3), np.int64(3)):
+            result = source.dwithin(Point(0, 0), distance)
+            self.check_pd_series_equal(result, broadcast_expected)
+
+    def test_dwithin_distances_follow_geometry_alignment(self):
+        index_name = "feature_id"
+        left = GeoSeries(
+            [Point(100, 0), Point(0, 0), Point(0, 0)],
+            index=pd.Index(["b", "a", "c"], name=index_name),
+        )
+        right = GeoSeries(
+            [Point(2, 0), Point(2, 0), Point(9, 0)],
+            index=pd.Index(["c", "a", "d"], name=index_name),
+        )
+
+        aligned_expected = pd.Series(
+            [False, False, True, False],
+            index=pd.Index(["a", "b", "c", "d"], name=index_name),
+        )
+        aligned = left.dwithin(right, [1, 99, 2, 99], align=True)
+        self.check_pd_series_equal(aligned, aligned_expected)
+
+        with pytest.warns(UserWarning, match="indices of the left and right"):
+            default_aligned = left.dwithin(right, [1, 99, 2, 99])
+        self.check_pd_series_equal(default_aligned, aligned_expected)
+
+        positional_expected = pd.Series(
+            [False, True, False],
+            index=pd.Index(["b", "a", "c"], name=index_name),
+        )
+        positional = left.dwithin(right, [1, 99, 2], align=False)
+        self.check_pd_series_equal(positional, positional_expected)
+
+        with pytest.raises(Exception, match="distance array must contain"):
+            left.dwithin(right, [1, 99, 2], align=True).to_pandas()
+        with pytest.raises(Exception, match="distance array must contain"):
+            left.dwithin(right, [1, 99, 2, 99], align=False).to_pandas()
+
+    def test_dwithin_distributed_distance_series(self):
+        index = pd.Index(["a", "a", "b"], name="feature_id")
+        source = GeoSeries(
+            [Point(0, 0), Point(2, 0), Point(5, 0)],
+            index=index,
+        )
+        expected = pd.Series([True, False, True], index=index)
+
+        independent_distance = ps.Series(
+            [0, 1, 5],
+            index=pd.Index(["ignored-c", "ignored-a", "ignored-b"]),
+        )
+        independent = source.dwithin(Point(0, 0), independent_distance)
+        self.check_pd_series_equal(independent, expected)
+
+        same_anchor_frame = GeoDataFrame(
+            gpd.GeoDataFrame(
+                {
+                    "geometry": [Point(0, 0), Point(2, 0), Point(5, 0)],
+                    "distance": [0, 1, 5],
+                },
+                index=index,
+            )
+        )
+        same_anchor = same_anchor_frame.geometry.dwithin(
+            Point(0, 0),
+            same_anchor_frame["distance"],
+        )
+        self.check_pd_series_equal(same_anchor, expected)
+        if hasattr(same_anchor._internal.spark_frame, "_jdf"):
+            same_anchor_plan = (
+                same_anchor._internal.spark_frame._jdf.queryExecution()
+                .executedPlan()
+                .toString()
+            )
+            assert "AttachDistributedSequence" not in same_anchor_plan
+            assert "Join" not in same_anchor_plan
+
+        if hasattr(independent._internal.spark_frame, "_jdf"):
+            plan = (
+                independent._internal.spark_frame._jdf.queryExecution()
+                .executedPlan()
+                .toString()
+            )
+            assert "BatchEvalPython" not in plan
+            assert "ArrowEvalPython" not in plan
+            assert "PythonUDF" not in plan
+
+    def test_dwithin_duplicate_multiindex_alignment(self):
+        left_index = pd.MultiIndex.from_tuples(
+            [("a", 1), ("a", 1), ("c", 3)],
+            names=["group", "row"],
+        )
+        right_index = pd.MultiIndex.from_tuples(
+            [("a", 1), ("a", 1), ("b", 2)],
+            names=["group", "row"],
+        )
+        left = GeoSeries(
+            [Point(0, 0), Point(10, 0), Point(50, 0)],
+            index=left_index,
+        )
+        right = GeoSeries(
+            [Point(1, 0), Point(12, 0), Point(60, 0)],
+            index=right_index,
+        )
+
+        result = left.dwithin(
+            right,
+            [1, 11, 9, 1, 100, 100],
+            align=True,
+        )
+        expected_index = pd.MultiIndex.from_tuples(
+            [
+                ("a", 1),
+                ("a", 1),
+                ("a", 1),
+                ("a", 1),
+                ("b", 2),
+                ("c", 3),
+            ],
+            names=["group", "row"],
+        )
+        expected = pd.Series(
+            [True, False, True, False, False, False],
+            index=expected_index,
+        )
+        self.check_pd_series_equal(result, expected)
+
+        scalar_result = left.dwithin(Point(0, 0), [0, 10, 49])
+        scalar_expected = pd.Series([True, True, False], index=left_index)
+        self.check_pd_series_equal(scalar_result, scalar_expected)
+
+    def test_dwithin_special_values_and_distance_validation(self):
+        source = GeoSeries([Point(), None, Point(2, 0), Point(0, 0), Point(0, 0)])
+        result = source.dwithin(
+            Point(0, 0),
+            np.array([np.inf, np.inf, np.inf, np.nan, -1.0]),
+        )
+        self.check_pd_series_equal(
+            result,
+            pd.Series([False, False, True, False, False]),
+        )
+
+        for distances in ([], [1, 2], [1, 2, 3, 4, 5, 6], pd.Series([1])):
+            with pytest.raises(Exception, match="distance array must contain"):
+                source.dwithin(Point(0, 0), distances).to_pandas()
+
+        for distances in (
+            ps.Series([1, 2]),
+            ps.Series([1, 2, 3, 4, 5, 6]),
+        ):
+            with pytest.raises(Exception, match="distance array must contain"):
+                source.dwithin(Point(0, 0), distances).to_pandas()
+
+        with pytest.raises(ValueError, match="one-dimensional"):
+            source.dwithin(Point(0, 0), np.ones((5, 1)))
+        with pytest.raises(TypeError, match="numeric"):
+            source.dwithin(Point(0, 0), ["1", "2", "3", "4", "5"])
+        with pytest.raises(TypeError, match="numeric"):
+            source.dwithin(Point(0, 0), [1, 2, 3, 4, pd.NA])
+        with pytest.raises(TypeError, match="numeric"):
+            source.dwithin(
+                Point(0, 0),
+                pd.Series([1, 2, 3, 4, pd.NA], dtype="Float64"),
+            )
+        with pytest.raises(TypeError, match="numeric"):
+            source.dwithin(Point(0, 0), Decimal("1"))
+        with pytest.raises(TypeError, match="numeric"):
+            source.dwithin(Point(0, 0), [1, 2, 3, 4, Decimal("5")])
+        with pytest.raises(TypeError, match="numeric"):
+            source.dwithin(Point(0, 0), ps.Series(["1"] * 5))
+        with pytest.raises(TypeError, match="numeric"):
+            source.dwithin(Point(0, 0), ps.Series([Decimal("1")] * 5))
+        with pytest.raises(
+            ValueError,
+            match=r"Lengths of inputs do not match\. Left: 1, Right: 2",
+        ):
+            GeoSeries([Point(0, 0)]).dwithin(
+                GeoSeries([Point(0, 0), Point(1, 1)]),
+                1,
+                align=False,
+            )
+
+        empty = GeoSeries([])
+        for distances in ([], np.array([]), ps.Series([], dtype=float)):
+            empty_result = empty.dwithin(Point(0, 0), distances)
+            self.check_pd_series_equal(empty_result, pd.Series([], dtype=bool))
+
     def test_difference(self):
         s = GeoSeries(
             [
@@ -1860,6 +2068,83 @@ e": "Feature", "properties": {}, "geometry": {"type": "Point", "coordinates": [3
         with pytest.raises(NotImplementedError):
             s.voronoi_polygons(only_edges=True)
 
+    def test_voronoi_polygons_extend_to(self):
+        source_geometry = MultiPoint([(0, 0), (1, 0), (0.5, 1)])
+        index = pd.MultiIndex.from_tuples([("group", 7)], names=["group", "feature_id"])
+        source = GeoSeries([source_geometry], index=index, crs="EPSG:3857")
+
+        default = source.voronoi_polygons()
+        extended = source.voronoi_polygons(extend_to=box(-2, 0, 3, 3))
+        contained = source.voronoi_polygons(extend_to=box(0.25, 0.25, 0.75, 0.75))
+        nonrectangular = source.voronoi_polygons(
+            extend_to=Polygon([(-2, 0), (3, 0), (0, 3)])
+        )
+        same_envelope = source.voronoi_polygons(extend_to=box(-2, 0, 3, 3))
+        empty_extent = source.voronoi_polygons(extend_to=GeometryCollection())
+
+        default_geometry = default.to_geopandas().iloc[0]
+        extended_result = extended.to_geopandas()
+        extended_geometry = extended_result.iloc[0]
+        assert extended_result.index.equals(index)
+        assert extended_geometry.bounds == pytest.approx((-2.0, -1.0, 3.0, 3.0))
+        assert contained.to_geopandas().iloc[0].equals(default_geometry)
+        assert (
+            nonrectangular.to_geopandas()
+            .iloc[0]
+            .equals(same_envelope.to_geopandas().iloc[0])
+        )
+        assert empty_extent.to_geopandas().iloc[0].equals(default_geometry)
+        assert extended.crs == source.crs
+
+        srids = extended._internal.spark_frame.select(
+            stf.ST_SRID(extended.spark.column).alias("srid")
+        ).collect()
+        assert [row.srid for row in srids] == [3857]
+
+        frame_source = GeoSeries([source_geometry], crs="EPSG:3857")
+        frame_result = frame_source.to_geoframe().voronoi_polygons(
+            extend_to=box(-2, 0, 3, 3)
+        )
+        frame_expected = gpd.GeoSeries([extended_geometry], crs="EPSG:3857")
+        self.check_sgpd_equals_gpd(frame_result, frame_expected)
+
+        if hasattr(extended._internal.spark_frame, "_jdf"):
+            plan = (
+                extended._internal.spark_frame._jdf.queryExecution()
+                .executedPlan()
+                .toString()
+            )
+            assert "BatchEvalPython" not in plan
+            assert "ArrowEvalPython" not in plan
+
+        for invalid_extent in (
+            [box(0, 0, 1, 1)],
+            "POLYGON ((0 0, 1 0, 1 1, 0 0))",
+            source,
+            ps.Series([1]),
+        ):
+            with pytest.raises(TypeError, match="'extend_to' must be a geometry"):
+                source.voronoi_polygons(extend_to=invalid_extent)
+
+    def test_voronoi_polygons_extend_to_degenerate_inputs(self):
+        source = GeoSeries.from_wkt(
+            [
+                None,
+                "GEOMETRYCOLLECTION EMPTY",
+                "POINT (0 0)",
+                "MULTIPOINT ((0 0), (1 0))",
+            ]
+        )
+        result = source.voronoi_polygons(extend_to=LineString([(-2, 0), (3, 0)]))
+        actual = result.to_geopandas()
+
+        assert actual.iloc[0] is None
+        assert actual.iloc[1].is_empty
+        assert actual.iloc[2].geom_type == "GeometryCollection"
+        assert actual.iloc[2].bounds == pytest.approx((-2.0, 0.0, 3.0, 0.0))
+        assert actual.iloc[3].geom_type == "GeometryCollection"
+        assert actual.iloc[3].bounds == pytest.approx((-2.0, -1.0, 3.0, 1.0))
+
     def test_envelope(self):
         s = sgpd.GeoSeries(
             [
@@ -2163,6 +2448,217 @@ e": "Feature", "properties": {}, "geometry": {"type": "Point", "coordinates": [3
         df_result = gdf.minimum_bounding_circle()
         self.check_sgpd_equals_gpd(df_result, expected)
 
+    def test_maximum_inscribed_circle(self):
+        geoms = [
+            Polygon([(0, 0), (1, 0), (1, 1), (0, 0)]),
+            Polygon([(0, 0), (0.5, -1), (1, 0), (1, 1), (-0.5, 0.5)]),
+            MultiPolygon(
+                [
+                    Polygon([(0, 0), (0, 2), (2, 2), (2, 0), (0, 0)]),
+                    Polygon([(10, 0), (10, 1), (11, 1), (11, 0), (10, 0)]),
+                ]
+            ),
+            None,
+        ]
+        index = pd.Index(["first", "first", "multi", "null"], name="feature_id")
+        source = GeoSeries(geoms, index=index, crs="EPSG:3857")
+        # Keep this direct test runnable with GeoPandas < 1.1. The version-gated
+        # parity test compares these results with GeoPandas dynamically.
+        expected = gpd.GeoSeries(
+            [
+                LineString([(0.70703125, 0.29296875), (0.5, 0.5)]),
+                LineString([(0.466796875, 0.259765625), (1, 0.259765625)]),
+                LineString([(1, 1), (0, 1)]),
+                None,
+            ],
+            index=index,
+            crs="EPSG:3857",
+        )
+
+        result = source.maximum_inscribed_circle()
+        self.check_sgpd_equals_gpd(result, expected)
+        assert result.name is None
+        assert result.crs == source.crs
+        srids = result._internal.spark_frame.select(
+            stf.ST_SRID(result.spark.column).alias("srid")
+        ).collect()
+        assert {row.srid for row in srids if row.srid is not None} == {3857}
+
+        frame = GeoDataFrame(
+            gpd.GeoDataFrame(
+                {
+                    "geometry": geoms,
+                    "tolerance": [0.0, 2.0, 0.5, np.nan],
+                    "label": ["a", "b", "c", "d"],
+                },
+                index=index,
+                crs="EPSG:3857",
+            )
+        )
+        row_wise = frame.geometry.maximum_inscribed_circle(tolerance=frame["tolerance"])
+        row_wise_expected = gpd.GeoSeries(
+            [
+                LineString([(0.70703125, 0.29296875), (0.5, 0.5)]),
+                LineString([(0.375, 0.25), (0, 0)]),
+                LineString([(1, 1), (0, 1)]),
+                None,
+            ],
+            index=index,
+            crs="EPSG:3857",
+        )
+        self.check_sgpd_equals_gpd(row_wise, row_wise_expected)
+
+        local_tolerances = [0.0, 2.0, 0.5, np.nan]
+        for local_tolerance in (
+            local_tolerances,
+            np.asarray(local_tolerances),
+            pd.Series(local_tolerances, index=index),
+        ):
+            local_result = source.maximum_inscribed_circle(tolerance=local_tolerance)
+            self.check_sgpd_equals_gpd(local_result, row_wise_expected)
+
+        self.check_sgpd_equals_gpd(
+            source.maximum_inscribed_circle(tolerance=0),
+            expected,
+        )
+        self.check_sgpd_equals_gpd(
+            source.maximum_inscribed_circle(tolerance=np.asarray(0)),
+            expected,
+        )
+        self.check_sgpd_equals_gpd(
+            source.maximum_inscribed_circle(tolerance=[0]),
+            expected,
+        )
+        assert (
+            len(
+                GeoSeries([], crs="EPSG:3857").maximum_inscribed_circle(
+                    tolerance=np.array([0])
+                )
+            )
+            == 0
+        )
+        self.check_sgpd_equals_gpd(
+            frame.maximum_inscribed_circle(tolerance=2.0),
+            gpd.GeoSeries(
+                [
+                    LineString([(0.75, 0.5), (0.625, 0.625)]),
+                    LineString([(0.375, 0.25), (0, 0)]),
+                    LineString([(1, 1), (0, 1)]),
+                    None,
+                ],
+                index=index,
+                crs="EPSG:3857",
+            ),
+        )
+
+        spark_frame = row_wise._internal.spark_frame
+        if hasattr(spark_frame, "_jdf"):
+            optimized_plan = (
+                spark_frame._jdf.queryExecution().optimizedPlan().toString()
+            )
+            assert optimized_plan.lower().count("st_maximuminscribedcircle") == 1
+            assert "BatchEvalPython" not in optimized_plan
+            assert "ArrowEvalPython" not in optimized_plan
+            assert "PythonUDF" not in optimized_plan
+
+        nan_result = source.maximum_inscribed_circle(tolerance=np.nan).to_geopandas()
+        assert nan_result.isna().all()
+
+        degenerate = GeoSeries(
+            [Polygon([(0, 0), (0, 0), (0, 0), (0, 0)])],
+            crs="EPSG:3857",
+        )
+        self.check_sgpd_equals_gpd(
+            degenerate.maximum_inscribed_circle(),
+            gpd.GeoSeries(
+                [LineString([(0, 0), (0, 0)])],
+                crs="EPSG:3857",
+            ),
+        )
+        self.check_sgpd_equals_gpd(
+            degenerate.maximum_inscribed_circle(tolerance=2.0),
+            gpd.GeoSeries(
+                [LineString([(0, 0), (0, 0)])],
+                crs="EPSG:3857",
+            ),
+        )
+
+        with pytest.raises(ValueError, match="'tolerance' should be positive"):
+            source.maximum_inscribed_circle(tolerance=-1)
+        with pytest.raises(ValueError, match="'tolerance' should be positive"):
+            source.maximum_inscribed_circle(tolerance=np.array(-1.0))
+        with pytest.raises(Exception, match="'tolerance' should be positive"):
+            source.maximum_inscribed_circle(
+                tolerance=[-1.0] * len(source)
+            ).to_geopandas()
+        with pytest.raises(Exception, match="'tolerance' should be positive"):
+            frame.geometry.maximum_inscribed_circle(
+                tolerance=frame["tolerance"] - 3.0
+            ).to_geopandas()
+        with pytest.raises(ValueError, match="must share the same frame"):
+            source.maximum_inscribed_circle(tolerance=ps.Series([0.1] * len(source)))
+        with pytest.raises(TypeError, match="numeric scalar"):
+            frame.geometry.maximum_inscribed_circle(tolerance=frame["label"])
+        with pytest.raises(TypeError, match="numeric scalar"):
+            source.maximum_inscribed_circle(tolerance=["0.1"] * len(source))
+        with pytest.raises(TypeError, match="numeric scalar"):
+            source.maximum_inscribed_circle(tolerance=Decimal("0.1"))
+        with pytest.raises(TypeError, match="numeric scalar"):
+            source.maximum_inscribed_circle(tolerance=[Decimal("0.1")] * len(source))
+        for mismatched_tolerance in (
+            [0.1] * (len(source) - 1),
+            [0.1] * (len(source) + 1),
+        ):
+            with pytest.raises(Exception, match="Length of tolerance"):
+                source.maximum_inscribed_circle(
+                    tolerance=mismatched_tolerance
+                ).to_geopandas()
+        with pytest.raises(Exception, match="Index of the Series"):
+            source.maximum_inscribed_circle(
+                tolerance=pd.Series(
+                    local_tolerances,
+                    index=pd.Index(
+                        ["first", "multi", "first", "null"],
+                        name="feature_id",
+                    ),
+                )
+            ).to_geopandas()
+
+        with pytest.raises(
+            Exception,
+            match="Input geometry must be a Polygon or MultiPolygon",
+        ):
+            GeoSeries([Point(0, 0)]).maximum_inscribed_circle().to_geopandas()
+        with pytest.raises(
+            Exception,
+            match="Empty input geometry is not supported",
+        ):
+            GeoSeries([Polygon()]).maximum_inscribed_circle().to_geopandas()
+
+    def test_maximum_inscribed_circle_local_tolerance_preserves_order(self):
+        adaptive_enabled = self.spark.conf.get("spark.sql.adaptive.enabled")
+        shuffle_partitions = self.spark.conf.get("spark.sql.shuffle.partitions")
+        try:
+            self.spark.conf.set("spark.sql.adaptive.enabled", "false")
+            self.spark.conf.set("spark.sql.shuffle.partitions", "8")
+            expected_index = pd.Index(
+                [f"feature-{position:03d}" for position in range(100)],
+                name="feature_id",
+            )
+            source = GeoSeries(
+                [Polygon([(0, 0), (1, 0), (1, 1), (0, 0)])] * 100,
+                index=expected_index,
+            )
+
+            actual = source.maximum_inscribed_circle(
+                tolerance=[2.0] * len(source)
+            ).to_geopandas()
+
+            pd.testing.assert_index_equal(actual.index, expected_index)
+        finally:
+            self.spark.conf.set("spark.sql.adaptive.enabled", adaptive_enabled)
+            self.spark.conf.set("spark.sql.shuffle.partitions", shuffle_partitions)
+
     def test_minimum_bounding_radius(self):
         s = GeoSeries(
             [
diff --git a/python/tests/geopandas/test_match_geopandas_series.py b/python/tests/geopandas/test_match_geopandas_series.py
index 4fa9f81d680..d3b95193893 100644
--- a/python/tests/geopandas/test_match_geopandas_series.py
+++ b/python/tests/geopandas/test_match_geopandas_series.py
@@ -34,6 +34,7 @@ from shapely.geometry import (
     MultiPolygon,
     GeometryCollection,
     LinearRing,
+    box,
 )
 
 from sedona.spark.geopandas import GeoSeries
@@ -680,6 +681,19 @@ class TestMatchGeopandasSeries(TestGeopandasBase):
                 )
                 self.check_pd_series_equal(sgpd_result, gpd_result)
 
+                distances = np.arange(len(geom), dtype=float)
+                sgpd_result = GeoSeries(geom).dwithin(
+                    GeoSeries(geom2),
+                    distance=distances,
+                    align=False,
+                )
+                gpd_result = gpd.GeoSeries(geom).dwithin(
+                    gpd.GeoSeries(geom2),
+                    distance=distances,
+                    align=False,
+                )
+                self.check_pd_series_equal(sgpd_result, gpd_result)
+
     def test_difference(self):
         for geom, geom2 in self.pairs:
             # Sedona doesn't support difference for GeometryCollections
@@ -987,6 +1001,19 @@ class TestMatchGeopandasSeries(TestGeopandasBase):
             collected = result.to_geopandas()
             assert len(collected) == len(geom)
 
+    def test_voronoi_polygons_extend_to(self):
+        if parse_version(gpd.__version__) < parse_version("1.0.0"):
+            pytest.skip("geopandas voronoi_polygons requires version 1.0.0 or higher")
+
+        geometry = MultiPoint([(0, 0), (1, 0), (0.5, 1)])
+        extent = box(-2, 0, 3, 3)
+        actual = GeoSeries([geometry]).voronoi_polygons(extend_to=extent).to_geopandas()
+        expected = gpd.GeoSeries([geometry]).voronoi_polygons(extend_to=extent)
+
+        # Sedona keeps the cells for each input row in one GeometryCollection,
+        # while GeoPandas returns one row per cell. Compare their combined extent.
+        assert actual.iloc[0].bounds == pytest.approx(expected.union_all().bounds)
+
     def test_envelope(self):
         for geom in self.geoms:
             sgpd_result = GeoSeries(geom).envelope
@@ -1129,6 +1156,45 @@ class TestMatchGeopandasSeries(TestGeopandasBase):
             gpd_result = gpd.GeoSeries(geom).minimum_bounding_circle()
             self.check_sgpd_equals_gpd(sgpd_result, gpd_result, tolerance=0.5)
 
+    def test_maximum_inscribed_circle(self):
+        if parse_version(gpd.__version__) < parse_version("1.1.0"):
+            pytest.skip(
+                "geopandas maximum_inscribed_circle requires version 1.1.0 or higher"
+            )
+        if parse_version(shapely.__version__) < parse_version("2.1.0"):
+            pytest.skip(
+                "geopandas maximum_inscribed_circle requires shapely 2.1.0 or higher"
+            )
+
+        geoms = [
+            Polygon([(0, 0), (1, 0), (1, 1), (0, 0)]),
+            Polygon([(0, 0), (0.5, -1), (1, 0), (1, 1), (-0.5, 0.5)]),
+            MultiPolygon(
+                [
+                    Polygon([(0, 0), (0, 2), (2, 2), (2, 0), (0, 0)]),
+                    Polygon([(10, 0), (10, 1), (11, 1), (11, 0), (10, 0)]),
+                ]
+            ),
+            None,
+        ]
+        for tolerance in (None, 2.0):
+            sgpd_result = GeoSeries(geoms).maximum_inscribed_circle(tolerance=tolerance)
+            gpd_result = gpd.GeoSeries(geoms).maximum_inscribed_circle(
+                tolerance=tolerance
+            )
+            self.check_sgpd_equals_gpd(sgpd_result, gpd_result)
+
+        # GeoPandas' own compatibility test uses row-wise zero and coarse
+        # tolerances, including zero as the per-geometry automatic tolerance.
+        local_tolerance = np.array([0, 10])
+        sgpd_result = GeoSeries(geoms[:2]).maximum_inscribed_circle(
+            tolerance=local_tolerance
+        )
+        gpd_result = gpd.GeoSeries(geoms[:2]).maximum_inscribed_circle(
+            tolerance=local_tolerance
+        )
+        self.check_sgpd_equals_gpd(sgpd_result, gpd_result)
+
     def test_minimum_bounding_radius(self):
         for geom in self.geoms:
             sgpd_result = GeoSeries(geom).minimum_bounding_radius()
diff --git a/python/tests/sql/test_dataframe_api.py b/python/tests/sql/test_dataframe_api.py
index 8ca732b5b62..522534eb834 100644
--- a/python/tests/sql/test_dataframe_api.py
+++ b/python/tests/sql/test_dataframe_api.py
@@ -841,6 +841,13 @@ test_configurations = [
         "geom.radius",
         0.2927864015850548,
     ),
+    (
+        stf.ST_MaximumInscribedCircle,
+        ("geom", 2.0),
+        "triangle_geom",
+        "ST_AsText(geom.center)",
+        "POINT (0.75 0.5)",
+    ),
     (stf.ST_MaxDistance, ("a", "b"), "overlapping_polys", "", 3.1622776601683795),
     (stf.ST_Perimeter, ("geom",), "triangle_geom", "", 3.414213562373095),
     (stf.ST_Perimeter, ("geom", True), "triangle_geom", "ceil(geom)", 378794),
@@ -1554,6 +1561,7 @@ wrong_type_configurations = [
     (stf.ST_MakeValid, (None,)),
     (stf.ST_MakePolygon, (None,)),
     (stf.ST_MaximumInscribedCircle, (None,)),
+    (stf.ST_MaximumInscribedCircle, ("", [])),
     (stf.ST_MaxDistance, (None, None)),
     (stf.ST_MaxDistance, (None, "")),
     (stf.ST_MaxDistance, ("", None)),
diff --git a/python/tests/sql/test_function.py b/python/tests/sql/test_function.py
index 11535d09937..cfa6935fb22 100644
--- a/python/tests/sql/test_function.py
+++ b/python/tests/sql/test_function.py
@@ -471,6 +471,35 @@ class TestPredicateJoin(TestBase):
         )
         assert actual.radius == pytest.approx(45.18896951053177, 1e-6)
 
+        triangle_df = self.spark.sql(
+            "SELECT ST_GeomFromWKT(" "'POLYGON ((0 0, 1 0, 1 1, 0 0))') AS geom"
+        )
+        coarse = triangle_df.selectExpr("ST_MaximumInscribedCircle(geom, 2.0)").first()[
+            0
+        ]
+        self.assert_geometry_almost_equal("POINT (0.75 0.5)", coarse.center)
+        self.assert_geometry_almost_equal("POINT (0.625 0.625)", coarse.nearest)
+        assert coarse.radius == pytest.approx(0.1767766952966369)
+
+        assert (
+            self.spark.sql(
+                "SELECT ST_MaximumInscribedCircle(ST_GeomFromWKT(NULL))"
+            ).first()[0]
+            is None
+        )
+        assert (
+            triangle_df.selectExpr(
+                "ST_MaximumInscribedCircle(geom, CAST(NULL AS DOUBLE))"
+            ).first()[0]
+            is None
+        )
+        assert (
+            triangle_df.selectExpr(
+                "ST_MaximumInscribedCircle(geom, CAST('NaN' AS DOUBLE))"
+            ).first()[0]
+            is None
+        )
+
     def test_st_is_valid_detail(self):
         baseDf = self.spark.sql(
             "SELECT ST_GeomFromText('POLYGON ((0 0, 2 0, 2 2, 0 2, 1 1, 0 0))') AS geom"
diff --git a/spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/Functions.scala b/spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/Functions.scala
index d2bc07fdab9..3a3ea58ccfb 100644
--- a/spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/Functions.scala
+++ b/spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/Functions.scala
@@ -1291,13 +1291,45 @@ private[apache] case class ST_MakePolygon(inputExpressions: Seq[Expression])
 
 private[apache] case class ST_MaximumInscribedCircle(children: Seq[Expression])
     extends Expression
+    with ImplicitCastInputTypes
     with CodegenFallback {
 
+  private val nArgs = children.length
+
+  override def inputTypes: Seq[AbstractDataType] = nArgs match {
+    case 1 => Seq(GeometryUDT())
+    case 2 => Seq(GeometryUDT(), DoubleType)
+    case _ =>
+      throw new IllegalArgumentException("ST_MaximumInscribedCircle expects one or two arguments")
+  }
+
   override def eval(input: InternalRow): Any = {
     val geometry = children.head.toGeometry(input)
+    var tolerance: java.lang.Double = null
     try {
-      var inscribedCircle: InscribedCircle = null
-      inscribedCircle = Functions.maximumInscribedCircle(geometry)
+      if (geometry == null) {
+        return null
+      }
+
+      if (nArgs == 2) {
+        tolerance = children(1).eval(input) match {
+          case null => return null
+          case value: Number => value.doubleValue()
+          case value =>
+            throw new IllegalArgumentException(
+              s"Tolerance must be numeric, but received ${value.getClass.getSimpleName}")
+        }
+      }
+
+      val inscribedCircle: InscribedCircle =
+        if (tolerance == null) {
+          Functions.maximumInscribedCircle(geometry)
+        } else {
+          Functions.maximumInscribedCircle(geometry, tolerance)
+        }
+      if (inscribedCircle == null) {
+        return null
+      }
 
       val serCenter = GeometrySerializer.serialize(inscribedCircle.center)
       val serNearest = GeometrySerializer.serialize(inscribedCircle.nearest)
@@ -1306,7 +1338,7 @@ private[apache] case class ST_MaximumInscribedCircle(children: Seq[Expression])
       case e: Exception =>
         InferredExpression.throwExpressionInferenceException(
           getClass.getSimpleName,
-          Seq(geometry),
+          if (nArgs == 1) Seq(geometry) else Seq(geometry, tolerance),
           e)
     }
   }
diff --git a/spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/st_functions.scala b/spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/st_functions.scala
index df2c8f94a00..b34a6a608ea 100644
--- a/spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/st_functions.scala
+++ b/spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/st_functions.scala
@@ -533,6 +533,10 @@ object st_functions {
     wrapExpression[ST_MaximumInscribedCircle](geometry)
   def ST_MaximumInscribedCircle(geometry: String): Column =
     wrapExpression[ST_MaximumInscribedCircle](geometry)
+  def ST_MaximumInscribedCircle(geometry: Column, tolerance: Column): Column =
+    wrapExpression[ST_MaximumInscribedCircle](geometry, tolerance)
+  def ST_MaximumInscribedCircle(geometry: String, tolerance: Double): Column =
+    wrapExpression[ST_MaximumInscribedCircle](geometry, tolerance)
 
   def ST_MaxDistance(geom1: Column, geom2: Column): Column =
     wrapExpression[ST_MaxDistance](geom1, geom2)
diff --git a/spark/common/src/test/scala/org/apache/sedona/sql/dataFrameAPITestScala.scala b/spark/common/src/test/scala/org/apache/sedona/sql/dataFrameAPITestScala.scala
index d88fa1457b9..40f90338e72 100644
--- a/spark/common/src/test/scala/org/apache/sedona/sql/dataFrameAPITestScala.scala
+++ b/spark/common/src/test/scala/org/apache/sedona/sql/dataFrameAPITestScala.scala
@@ -2499,6 +2499,20 @@ class dataFrameAPITestScala extends TestBaseScala {
         "POINT (61.64205411585366 104.55256764481707)",
         actual.getAs[Geometry](1))
       assertEquals(45.18896951053177, actual.getDouble(2), 1e-6)
+
+      val triangleDf =
+        sparkSession.sql("SELECT ST_GeomFromWKT('POLYGON ((0 0, 1 0, 1 1, 0 0))') AS geom")
+      val coarse: Row =
+        triangleDf.select(ST_MaximumInscribedCircle("geom", 2.0)).first().getAs[Row](0)
+      assertGeometryEquals("POINT (0.75 0.5)", coarse.getAs[Geometry](0))
+      assertGeometryEquals("POINT (0.625 0.625)", coarse.getAs[Geometry](1))
+      assertEquals(0.1767766952966369, coarse.getDouble(2), 1e-12)
+
+      val explicitDefault: Row =
+        triangleDf.select(ST_MaximumInscribedCircle("geom", 0.0)).first().getAs[Row](0)
+      val implicitDefault: Row =
+        triangleDf.select(ST_MaximumInscribedCircle("geom")).first().getAs[Row](0)
+      assertEquals(implicitDefault, explicitDefault)
     }
 
     it("Should pass ST_IsValidTrajectory") {
diff --git a/spark/common/src/test/scala/org/apache/sedona/sql/functionTestScala.scala b/spark/common/src/test/scala/org/apache/sedona/sql/functionTestScala.scala
index 67dbae4be13..75fb6f1664b 100644
--- a/spark/common/src/test/scala/org/apache/sedona/sql/functionTestScala.scala
+++ b/spark/common/src/test/scala/org/apache/sedona/sql/functionTestScala.scala
@@ -3713,6 +3713,30 @@ class functionTestScala
       "POINT (61.64205411585366 104.55256764481707)",
       actual.getAs[Geometry](1))
     assertEquals(45.18896951053177, actual.getDouble(2), 1e-6)
+
+    val triangleDf =
+      sparkSession.sql("SELECT ST_GeomFromWKT('POLYGON ((0 0, 1 0, 1 1, 0 0))') AS geom")
+    val coarse: Row =
+      triangleDf.selectExpr("ST_MaximumInscribedCircle(geom, 2.0)").first().getAs[Row](0)
+    assertGeometryEquals("POINT (0.75 0.5)", coarse.getAs[Geometry](0))
+    assertGeometryEquals("POINT (0.625 0.625)", coarse.getAs[Geometry](1))
+    assertEquals(0.1767766952966369, coarse.getDouble(2), 1e-12)
+
+    assertTrue(
+      sparkSession
+        .sql("SELECT ST_MaximumInscribedCircle(ST_GeomFromWKT(NULL))")
+        .first()
+        .isNullAt(0))
+    assertTrue(
+      triangleDf
+        .selectExpr("ST_MaximumInscribedCircle(geom, CAST(NULL AS DOUBLE))")
+        .first()
+        .isNullAt(0))
+    assertTrue(
+      triangleDf
+        .selectExpr("ST_MaximumInscribedCircle(geom, CAST('NaN' AS DOUBLE))")
+        .first()
+        .isNullAt(0))
   }
 
   it("Should pass ST_IsValidTrajectory") {