Class 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 generic Geometry type. TODO for 1.0: Decide whether to remove it or keep it.
    Author:
    Horia Chiorean, Omar Al-Safi
    • Constructor Detail

      • Point

        public Point()
    • Method Detail

      • builder

        public static org.apache.kafka.connect.data.SchemaBuilder builder()
        Returns a SchemaBuilder 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 - coordinate
        y - 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 - a Schema instance which represents a point; may not be null
        x - the X coordinate of the point; may not be null
        y - 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 - a Schema instance which represents a point; may not be null
        wkb - the original Well-Known binary representation of the coordinate; may not be null
        srid - the coordinate reference system identifier; null if unset/unknown
        Returns:
        a Struct which represents a Connect value for this schema; never null
        Throws:
        IllegalArgumentException