You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "jiayuasu (via GitHub)" <gi...@apache.org> on 2026/10/23 05:57:43 UTC
[PR] feat(python/sedonadb-geopandas): add GeoSeries constructive methods [sedona-db]
jiayuasu opened a new pull request, #1487:
URL: https://github.com/apache/sedona-db/pull/1487
Stacked on #1486 (it reuses that PR's GeoPandas-style part count in `get_geometry()`); until #1486 merges, its commit shows here too. The last commit is this PR's.
## What changes
Adds the element-wise `GeoSeries` methods in `sedonadb-geopandas` that map onto existing engine functions and build new geometries:
- **`concave_hull(ratio=0.0)`** (`ST_ConcaveHull`), **`segmentize(max_segment_length)`** (`ST_Segmentize`), **`reverse()`** (`ST_Reverse`), **`set_precision(grid_size)`** (`ST_ReducePrecision`), **`force_2d()`** / **`force_3d(z=0)`** (`ST_Force2D` / `ST_Force3D`), and **`snap(other, tolerance)`** (`ST_Snap`, against a geometry scalar or a `GeoSeries` of the same frame, like the other binary operations).
- **`line_merge()`** (`ST_LineMerge`): an empty input gives an empty geometry collection, as in GeoPandas and as the engine already gives for any input without lines; the engine kept an empty input's own type. The choice is made through a helper now shared with `envelope`, which rebuilds the result with the engine's spatial kind and CRS.
- **`get_geometry(index)`** (`ST_GeometryN`): counts from 0, and a negative index counts back from the number of parts as GeoPandas counts them (a single-part geometry has one, even when empty).
Numeric parameters take a number or a numeric `Series` of the same frame, applied row by row as GeoPandas applies an array (and as `dwithin()` already does). A NaN gives a missing geometry, as in Shapely, except in `force_3d()`, which refuses one as GeoPandas does (for a row, when the result is computed). An out-of-range value (a `segmentize()` length that is not positive, a `concave_hull()` ratio outside [0, 1]) raises when the method is called; an infinite `segmentize()` length adds no vertices, as in GeoPandas.
Where GEOS does more than the operation itself, the engine's result is kept and documented in the README: `segmentize()` only adds vertices (GEOS also repairs an invalid polygon and turns a one-part multi-line into a line), `force_3d()` keeps Z and drops M (Shapely leaves a geometry with M but no Z as it is and replaces the Z values of one with both), and `snap()` leaves an empty geometry as it is (GEOS turns `POLYGON EMPTY` into `LINEARRING Z EMPTY`). Options without an engine equivalent (`concave_hull(allow_holes=True)`, `line_merge(directed=True)`, `set_precision()` modes other than `"valid_output"`) raise `NotImplementedError`.
`delaunay_triangles()` is left out: in GeoPandas 1.x it triangulates the vertices of the whole series rather than each geometry, so it belongs with the aggregates.
## Testing
`tests/test_geoseries.py` compares each method against GeoPandas: the plain cases join the constructive-method comparison over the shared corpus (empty and missing geometries included), and `segmentize()` and `set_precision()` are compared over the valid geometries of the measures corpus at several sizes. Separate tests cover the documented differences, `line_merge()` on lines that merge and on empties (and on geography, which keeps its kind and CRS), `get_geometry()` from either end and with a row-wise index, `snap()` with column and scalar operands, row-wise parameters for each method, NaN parameters (one value and per row), and the argument checks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(python/sedonadb-geopandas): add GeoSeries constructive methods [sedona-db]
Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on code in PR #1487:
URL: https://github.com/apache/sedona-db/pull/1487#discussion_r4364644224
##########
python/sedonadb-geopandas/README.md:
##########
@@ -95,6 +95,18 @@ GeoPandas' `align=False`; there is no index to align on. `touches` inherits
an engine issue with geometry collections that mix dimensions
(apache/sedona-db#1383).
+The numeric parameters of geometry methods (`segmentize()`, `set_precision()`,
+`concave_hull()`, `force_3d()`, `snap()`, `get_geometry()`) take a number or a
+numeric `Series` of the same frame, applied row by row. `segmentize()` only
+adds vertices, where GEOS also repairs an invalid polygon and turns a one-part
+multi-line into a line; `force_3d()` keeps Z values and drops M, where Shapely
+leaves a geometry with M but no Z as it is and replaces the Z values of one
+with both; and `snap()` leaves an empty geometry as it is, where GEOS can turn
+it into a 3D empty, or one of another type (`POLYGON EMPTY` becomes
+`LINEARRING Z EMPTY`). `concave_hull(allow_holes=True)`,
+`line_merge(directed=True)`, and `set_precision()` modes other than
+`"valid_output"` are not supported.
Review Comment:
Should we fix or file follow up issues for any of these?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(python/sedonadb-geopandas): add GeoSeries constructive methods [sedona-db]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on PR #1487:
URL: https://github.com/apache/sedona-db/pull/1487#issuecomment-6372306085
Since this PR is relatively simple, I plan to merge it within a day if there are no objections.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org