Class AbstractDatabricksGeospatial

  • All Implemented Interfaces:
    IDatabricksGeospatial
    Direct Known Subclasses:
    DatabricksGeography, DatabricksGeometry

    public abstract class AbstractDatabricksGeospatial
    extends Object
    implements IDatabricksGeospatial
    Abstract base class for geospatial data types in Databricks JDBC driver.

    This class provides common functionality for both GEOMETRY and GEOGRAPHY types, including storage of WKT (Well-Known Text) format data and access to both WKT and WKB representations.

    • Constructor Detail

      • AbstractDatabricksGeospatial

        protected AbstractDatabricksGeospatial​(String wkt,
                                               int srid)
                                        throws DatabricksValidationException
        Constructs an AbstractDatabricksGeospatial with the specified WKT and SRID.
        Parameters:
        wkt - the Well-Known Text representation of the geospatial object
        srid - the Spatial Reference System Identifier
        Throws:
        DatabricksValidationException - if the WKT is invalid
    • Method Detail

      • getWKB

        public byte[] getWKB()
        Returns the Well-Known Binary (WKB) representation of the geospatial object.
        Specified by:
        getWKB in interface IDatabricksGeospatial
        Returns:
        the WKB representation as a byte array
      • getSRID

        public int getSRID()
        Returns the Spatial Reference System Identifier (SRID) of the geospatial object.
        Specified by:
        getSRID in interface IDatabricksGeospatial
        Returns:
        the SRID value
      • getWKT

        public String getWKT()
        Returns the Well-Known Text (WKT) representation of the geospatial object.
        Specified by:
        getWKT in interface IDatabricksGeospatial
        Returns:
        the WKT string
      • toString

        public String toString()
        Returns a string representation of the geospatial object in EWKT format.
        Overrides:
        toString in class Object
        Returns:
        the EWKT string representation
      • equals

        public boolean equals​(Object obj)
        Checks if this geospatial object is equal to another object.
        Overrides:
        equals in class Object
        Parameters:
        obj - the object to compare
        Returns:
        true if the objects are equal, false otherwise
      • hashCode

        public int hashCode()
        Returns the hash code for this geospatial object.
        Overrides:
        hashCode in class Object
        Returns:
        the hash code
      • getType

        public abstract String getType()
        Returns the data type of the geospatial object.
        Specified by:
        getType in interface IDatabricksGeospatial
        Returns:
        the type as a string, either "GEOMETRY" or "GEOGRAPHY"