Class GeographyPointValue

java.lang.Object
org.voltdb.types.GeographyPointValue

public class GeographyPointValue extends Object
The Java class that corresponds to the SQL type GEOGRAPHY_POINT. Represents a point as defined by its longitude and latitude.
  • Constructor Details

    • GeographyPointValue

      public GeographyPointValue(double longitude, double latitude)
      Construct a new GeographyPointValue from its coordinates.
      Parameters:
      longitude - in degrees.
      latitude - in degrees.
  • Method Details

    • fromWKT

      public static GeographyPointValue fromWKT(String param)
      Create a GeographyPointValue from a well-known text string.
      Parameters:
      param - A well-known text string.
      Returns:
      A new instance of GeographyPointValue.
    • getLatitude

      public double getLatitude()
      Return the latitude of this point in degrees.
      Returns:
      The latitude of this point in degrees.
    • getLongitude

      public double getLongitude()
      Return the longitude of this point in degrees.
      Returns:
      The longitude of this point in degrees.
    • toString

      public String toString()
      Return this point as a well-known text string.
      Overrides:
      toString in class Object
      Returns:
      This point as a well-known text string.
    • toWKT

      public String toWKT()
      Return this point as a well-known text string.
      Returns:
      This point as a well-known text string.
    • getValueDisplaySize

      public static int getValueDisplaySize()
      The largest number of characters needed to represent a point value as a string.
      Returns:
      number of characters needed for display
    • equals

      public boolean equals(Object o)
      Compare this point with another object. Returns true if this point is being compared to another point that represents the same location.
      Overrides:
      equals in class Object
      See Also:
    • getLengthInBytes

      public static int getLengthInBytes()
      Returns the number of bytes an instance of this class requires when serialized to a ByteBuffer.
      Returns:
      The number of bytes an instance of this class requires when serialized to a ByteBuffer.
    • flattenToBuffer

      public void flattenToBuffer(ByteBuffer buffer)
      Serialize this point to a ByteBuffer.
      Parameters:
      buffer - The ByteBuffer to which this point will be serialized.
    • serialize

      public void serialize(DataOutput output) throws IOException
      Serialize this point to a DataOutput
      Parameters:
      output - to which this point will be serialized
      Throws:
      IOException - if any I/O error occurs
    • unflattenFromBuffer

      public static GeographyPointValue unflattenFromBuffer(ByteBuffer inBuffer, int offset)
      Deserializes a point from a ByteBuffer, at an absolute offset.
      Parameters:
      inBuffer - The ByteBuffer from which to read the bytes for a point.
      offset - Absolute offset of point data in buffer.
      Returns:
      A new instance of GeographyPointValue.
    • unflattenFromBuffer

      public static GeographyPointValue unflattenFromBuffer(ByteBuffer inBuffer)
      Deserialize a point from a ByteBuffer at the buffer's current position
      Parameters:
      inBuffer - The ByteBuffer from which to read the bytes for a point.
      Returns:
      A new instance of GeographyPointValue.
    • serializeNull

      public static void serializeNull(ByteBuffer buffer)
      Serialize the null point (that is, a SQL null value) to a ByteBuffer, at the buffer's current position.
      Parameters:
      buffer - The ByteBuffer to which a null point will be serialized.
    • normalizeLngLat

      public static GeographyPointValue normalizeLngLat(double longitude, double latitude)
      Create a GeographyPointValue with normalized coordinates. The longitude and latitude inputs may be any real numbers. They are not restricted to be in the ranges [-180,180] or [-90,90] respectively. The created instance will will have coordinates between (-180,180) and [-90,90].
      Parameters:
      longitude - in degrees, not range-restricted.
      latitude - in degrees, not range-restricted.
      Returns:
      A GeographyPointValue with the given coordinates normalized.