Package io.debezium.data.geometry
Class Point
java.lang.Object
io.debezium.data.geometry.Geometry
io.debezium.data.geometry.Point
A semantic type for a geometric Point, defined as a set of (x,y) coordinates.
This historically used to be a useful class, but is now mostly obsolete due
to the generic
Geometry type. TODO for 1.0: Decide whether to remove
it or keep it.- Author:
- Horia Chiorean, Omar Al-Safi
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprivate static final intprivate static final intstatic final Stringstatic final StringFields inherited from class io.debezium.data.geometry.Geometry
SRID_FIELD, WKB_FIELD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.kafka.connect.data.SchemaBuilderbuilder()Returns aSchemaBuilderfor a Point field.private static byte[]buildWKBPoint(double x, double y) Creates WKB for a 2D {x,y} point.static org.apache.kafka.connect.data.StructcreateValue(org.apache.kafka.connect.data.Schema geomSchema, byte[] wkb, Integer srid) Create a value for this schema using WKBstatic org.apache.kafka.connect.data.StructcreateValue(org.apache.kafka.connect.data.Schema geomSchema, double x, double y) Creates a value for this schema using 2 given coordinates.static double[]parseWKBPoint(byte[] wkb) Parses a 2D WKB Point into a {x,y} coordinate array.
-
Field Details
-
LOGICAL_NAME
- See Also:
-
X_FIELD
- See Also:
-
Y_FIELD
- See Also:
-
WKB_POINT
private static final int WKB_POINT- See Also:
-
WKB_POINT_SIZE
private static final int WKB_POINT_SIZE- See Also:
-
-
Constructor Details
-
Point
public Point()
-
-
Method Details
-
builder
public static org.apache.kafka.connect.data.SchemaBuilder builder()Returns aSchemaBuilderfor a Point field. A Geometry with extra X & Y fields- Returns:
- the schema builder
-
buildWKBPoint
private static byte[] buildWKBPoint(double x, double y) Creates WKB for a 2D {x,y} point.- Parameters:
x- coordinatey- coordinate- Returns:
- OGC WKB byte array
-
parseWKBPoint
Parses a 2D WKB Point into a {x,y} coordinate array. Returns null for any non-point or points with Z/M/etc modifiers.- Parameters:
wkb- OGC WKB geometry- Returns:
- x,y coordinate array
- Throws:
IllegalArgumentException
-
createValue
public static org.apache.kafka.connect.data.Struct createValue(org.apache.kafka.connect.data.Schema geomSchema, double x, double y) Creates a value for this schema using 2 given coordinates.- Parameters:
pointSchema- aSchemainstance which represents a point; may not be nullx- the X coordinate of the point; may not be nully- the Y coordinate of the point; may not be null- Returns:
- a
Structwhich represents a Connect value for this schema; never null
-
createValue
public static org.apache.kafka.connect.data.Struct createValue(org.apache.kafka.connect.data.Schema geomSchema, byte[] wkb, Integer srid) throws IllegalArgumentException Create a value for this schema using WKB- Parameters:
pointSchema- aSchemainstance which represents a point; may not be nullwkb- the original Well-Known binary representation of the coordinate; may not be nullsrid- the coordinate reference system identifier; null if unset/unknown- Returns:
- a
Structwhich represents a Connect value for this schema; never null - Throws:
IllegalArgumentException
-