Package io.delta.kernel.internal.util
Class GeometryUtils
Object
io.delta.kernel.internal.util.GeometryUtils
Utility for parsing and formatting WKT POINT strings for geometry/geography stats.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatPointWKT(double x, double y, OptionalDouble z, OptionalDouble m) Formats x/y (and optional z/m) coordinates as a WKT POINT string.static double[]parsePointXY(String wkt) Parses only the x and y coordinates from a WKT POINT string.static voidvalidateGeographyCoordinates(double lon, double lat, String wkt) Validates that longitude is in [-180, 180] and latitude is in [-90, 90].static voidValidates that the given WKT POINT is a valid geography point with coordinates in range: longitude in [-180, 180] and latitude in [-90, 90].static voidvalidatePointWKT(String wkt) Validates that the given string is a well-formed WKT POINT.
-
Method Details
-
formatPointWKT
Formats x/y (and optional z/m) coordinates as a WKT POINT string. Uses standard OGC WKT format: "POINT(1.0 2.0)", "POINT Z (1.0 2.0 3.0)", "POINT ZM (1.0 2.0 3.0 4.0)". -
validatePointWKT
Validates that the given string is a well-formed WKT POINT. Throws KernelException if the string is null or not a valid POINT WKT. -
parsePointXY
Parses only the x and y coordinates from a WKT POINT string. Returns double[]{x, y}. Z and M coordinates are validated but not returned because stats bounding boxes only use 2D coordinates.Supported formats: POINT(x y), POINT Z (x y z), POINT M (x y m), POINT ZM (x y z m), POINT EMPTY, POINT Z EMPTY, POINT M EMPTY, POINT ZM EMPTY.
All EMPTY variants return {NaN, NaN}.
- Throws:
IllegalArgumentException- if not a valid POINT WKT
-
validateGeographyPointWKT
Validates that the given WKT POINT is a valid geography point with coordinates in range: longitude in [-180, 180] and latitude in [-90, 90]. Throws KernelException if invalid. -
validateGeographyCoordinates
Validates that longitude is in [-180, 180] and latitude is in [-90, 90]. Throws KernelException if out of range.
-