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/09/21 08:13:13 UTC
[I] Preserve declared Z layouts in GeoParquet writes and handle measured inputs explicitly [sedona]
jiayuasu opened a new issue, #3383:
URL: https://github.com/apache/sedona/issues/3383
## Expected behavior
GeoParquet writes should preserve supported XYZ layouts, including declared empty geometries, NaN Z values, and a finite Z after the first coordinate. The WKB and `geometry_types` metadata should agree.
GeoParquet 1.1 does not support M ([specification](https://geoparquet.org/releases/v1.1.0/#wkb)). Measured inputs need an explicit error or documented conversion policy rather than silent loss. Switching this writer to unrestricted EWKB would not satisfy the format requirements.
## Actual behavior
`GeoParquetWriteSupport` uses `GeomUtils.createWKBWriter(GeomUtils.getDimension(geom))`. The dimension helper returns only 2 or 3, based on the first coordinate's Z. `GeometryColumnInfo` uses the same first-coordinate rule for its ` Z` suffix.
A probe of these helpers after Sedona geometry serialization produced:
| Input | Written result |
| --- | --- |
| Declared empty XYZ point, line, or polygon | XY empty |
| `POINT Z (1 2 NaN)` | XY point |
| `LINESTRING Z (1 2 NaN, 3 4 5)` | XY line; finite Z lost |
| `POINT M (1 2 7)` | XY point; M lost |
| `POINT ZM (1 2 3 7)` | XYZ point; M lost |
The metadata also reports XY for the first three cases. This is an existing writer limitation, unchanged by #3381. #3378 preserves declared dimensions on reads, so writes remain a gap in the round trip.
## Steps to reproduce
This Java snippet exercises the exact geometry serialization and WKB writer helpers used by the GeoParquet writer for a declared XYZ point with NaN Z:
```java
import org.apache.sedona.common.Constructors;
import org.apache.sedona.common.geometrySerde.GeometrySerializer;
import org.apache.sedona.common.utils.GeomUtils;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.io.WKBReader;
Geometry source = Constructors.geomFromWKB(WKBReader.hexToBytes(
"0101000080000000000000F03F0000000000000040000000000000F87F"));
Geometry input = GeometrySerializer.deserialize(GeometrySerializer.serialize(source));
byte[] written = GeomUtils.createWKBWriter(GeomUtils.getDimension(input)).write(input);
Point output = (Point) Constructors.geomFromWKB(written);
System.out.println(((Point) input).getCoordinateSequence().getDimension()); // 3
System.out.println(output.getCoordinateSequence().getDimension()); // 2
```
The probe covers the helpers, not a complete Spark file-write/read operation. The fix should add file-write/read regressions for empty XYZ primitives, NaN Z, later finite Z, XYM, and XYZM, with matching metadata checks.
## Environment
Sedona `2.0.0-SNAPSHOT`, writer code at `dc89c838107980c8249da55454285153ea41b17b`, JTS 1.20 with `org.datasyslab:jts-io-patch:1.21.0-datasyslab-2`.
Related: #3369, #3378, #3381, and the broader GeoParquet upgrade in #3146.
--
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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Preserve declared Z layouts in GeoParquet writes and handle measured inputs explicitly [sedona]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu closed issue #3383: Preserve declared Z layouts in GeoParquet writes and handle measured inputs explicitly
URL: https://github.com/apache/sedona/issues/3383
--
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