Package com.databricks.jdbc.api.impl.converters

## Class WKTConverter

- java.lang.Object
- - com.databricks.jdbc.api.impl.converters.WKTConverter

    public class WKTConverter
    extends Object

Utility class for converting between WKT (Well-Known Text) and WKB (Well-Known Binary) formats.

This class uses the JTS (Java Topology Suite) library to provide robust WKT/WKB conversion functionality for geospatial data. JTS is a widely-used, well-tested library that implements the OpenGIS Consortium's Simple Features Specification for SQL.

### Constructor Summary

Constructors
`WKTConverter()`

### Method Summary

All Methods Static Methods Concrete Methods
`static int` `extractSRIDFromEWKT​(String ewkt)` Extracts the SRID from an EWKT (Extended Well-Known Text) string.
`static String` `removeSRIDFromEWKT​(String ewkt)` Removes the SRID prefix from an EWKT string to get clean WKT.
`static byte[]` `toWKB​(String wkt)` Converts WKT (Well-Known Text) to WKB (Well-Known Binary) format.
`static String` `toWKT​(byte[] wkb)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### WKTConverter

    public WKTConverter()

### Method Detail

#### toWKB

    public static byte[] toWKB​(String wkt)
                        throws DatabricksValidationException

Converts WKT (Well-Known Text) to WKB (Well-Known Binary) format.

This implementation uses the JTS library to parse the WKT string into a Geometry object and then converts it to WKB format using the custom OGC-compliant WKB writer.

Parameters:
  `wkt` - the WKT string to convert
Returns:
  the WKB representation as a byte array
Throws:
  `DatabricksValidationException` - if the WKT is invalid

#### toWKT

    public static String toWKT​(byte[] wkb)
                        throws DatabricksValidationException

Throws:
  `DatabricksValidationException`

#### extractSRIDFromEWKT

    public static int extractSRIDFromEWKT​(String ewkt)

Extracts the SRID from an EWKT (Extended Well-Known Text) string.

EWKT format includes SRID prefix: "SRID=4326;POINT(1 2)"

Parameters:
  `ewkt` - the EWKT string
Returns:
  the SRID value, or 0 if no SRID is specified

#### removeSRIDFromEWKT

    public static String removeSRIDFromEWKT​(String ewkt)

Removes the SRID prefix from an EWKT string to get clean WKT.

Converts "SRID=4326;POINT(1 2)" to "POINT(1 2)"

Parameters:
  `ewkt` - the EWKT string
Returns:
  the clean WKT string without SRID prefix