Package io.debezium.data.geometry
Class Point
- java.lang.Object
-
- io.debezium.data.geometry.Geometry
-
- io.debezium.data.geometry.Point
-
public class Point extends Geometry
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 genericGeometry
type. TODO for 1.0: Decide whether to remove it or keep it.- Author:
- Horia Chiorean, Omar Al-Safi
-
-
Field Summary
Fields Modifier and Type Field Description static String
LOGICAL_NAME
private static int
WKB_POINT
private static int
WKB_POINT_SIZE
static String
X_FIELD
static String
Y_FIELD
-
Fields inherited from class io.debezium.data.geometry.Geometry
SRID_FIELD, WKB_FIELD
-
-
Constructor Summary
Constructors Constructor Description Point()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.kafka.connect.data.SchemaBuilder
builder()
Returns aSchemaBuilder
for 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.Struct
createValue(org.apache.kafka.connect.data.Schema geomSchema, byte[] wkb, Integer srid)
Create a value for this schema using WKBstatic 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.static double[]
parseWKBPoint(byte[] wkb)
Parses a 2D WKB Point into a {x,y} coordinate array.
-
-
-
Field Detail
-
LOGICAL_NAME
public static final String LOGICAL_NAME
- See Also:
- Constant Field Values
-
X_FIELD
public static final String X_FIELD
- See Also:
- Constant Field Values
-
Y_FIELD
public static final String Y_FIELD
- See Also:
- Constant Field Values
-
WKB_POINT
private static final int WKB_POINT
- See Also:
- Constant Field Values
-
WKB_POINT_SIZE
private static final int WKB_POINT_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
builder
public static org.apache.kafka.connect.data.SchemaBuilder builder()
Returns aSchemaBuilder
for 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
public static double[] parseWKBPoint(byte[] wkb) throws IllegalArgumentException
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
- aSchema
instance 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
Struct
which 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
- aSchema
instance 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
Struct
which represents a Connect value for this schema; never null - Throws:
IllegalArgumentException
-
-