Class GeographyType

Object
org.apache.spark.sql.types.DataType
org.apache.spark.sql.types.GeographyType
All Implemented Interfaces:
Serializable

public class GeographyType extends DataType implements Serializable
The data type representing GEOGRAPHY values which are spatial objects, as defined in the Open Geospatial Consortium (OGC) Simple Feature Access specification (https://portal.ogc.org/files/?artifact_id=25355), with a geographic coordinate system.
See Also:
  • Constructor Details

    • GeographyType

      public GeographyType()
  • Method Details

    • MIXED_SRID

      public static final int MIXED_SRID()
    • MIXED_CRS

      public static final String MIXED_CRS()
    • GEOGRAPHY_DEFAULT_SRID

      public static final int GEOGRAPHY_DEFAULT_SRID()
      Default CRS value for GeographyType depends on storage specification. Parquet and Iceberg use OGC:CRS84, which translates to SRID 4326 here.
      Returns:
      (undocumented)
    • GEOGRAPHY_DEFAULT_CRS

      public static final String GEOGRAPHY_DEFAULT_CRS()
    • GEOGRAPHY_DEFAULT_ALGORITHM

      public static final EdgeInterpolationAlgorithm.SPHERICAL$ GEOGRAPHY_DEFAULT_ALGORITHM()
    • GEOGRAPHY_DEFAULT_EPSG_CRS

      public static final String GEOGRAPHY_DEFAULT_EPSG_CRS()
    • isSridSupported

      public static boolean isSridSupported(int srid)
      Returns whether the given SRID is supported.
    • apply

      public static GeographyType apply(int srid)
      Constructors for GeographyType.
      Parameters:
      srid - (undocumented)
      Returns:
      (undocumented)
    • apply

      public static GeographyType apply(String crs)
    • apply

      public static GeographyType apply(String crs, String algorithm)
    • apply

      public static GeographyType apply(String crs, EdgeInterpolationAlgorithm algorithm)
    • crs

      public String crs()
    • algorithm

      public EdgeInterpolationAlgorithm algorithm()
    • srid

      public int srid()
      Spatial Reference Identifier (SRID) value of the geography type.
      Returns:
      (undocumented)
    • defaultSize

      public int defaultSize()
      The default size of a value of the GeographyType is 2048 bytes, which can store roughly 120 2D points.
      Specified by:
      defaultSize in class DataType
      Returns:
      (undocumented)
    • isMixedSrid

      public boolean isMixedSrid()
      The GeographyType is a mixed SRID type iff the SRID is MIXED_SRID. Semantically, this means that different SRID values per row are allowed.
      Returns:
      (undocumented)
    • typeName

      public String typeName()
      Type name that is displayed to users.
      Overrides:
      typeName in class DataType
      Returns:
      (undocumented)
    • toString

      public String toString()
      String representation of the GeographyType, which uses SRID for fixed SRID types and "ANY" for mixed SRID types, providing a clear and concise user-friendly format for this type.
      Overrides:
      toString in class Object
      Returns:
      (undocumented)
    • jsonValue

      public org.json4s.JValue jsonValue()
      JSON representation of the GeographyType, which uses the CRS string and edge interpolation algorithm string, in line with the current storage specifications (e.g. Parquet, Delta, Iceberg). Note that mixed SRID is disallowed, and only fixed SRID types can be stored. This is also in accordance to storage formats.
      Returns:
      (undocumented)
    • equals

      public boolean equals(Object obj)
      Two types are considered equal iff they are both GeographyTypes and have the same type info. For the GEOGRAPHY type, the SRID value and algorithm uniquely identify its type information.
      Overrides:
      equals in class Object
      Parameters:
      obj - (undocumented)
      Returns:
      (undocumented)
    • hashCode

      public int hashCode()
      The hash code of the GeographyType is derived from its SRID value.
      Overrides:
      hashCode in class Object
      Returns:
      (undocumented)
    • acceptsGeographyType

      public boolean acceptsGeographyType(GeographyType gt)
      The GeographyType with mixed SRID can accept any other GeographyType, i.e. either a fixed SRID GeographyType or another mixed SRID GeographyType. Conversely, a GeographyType with fixed SRID can only accept another GeographyType with the same fixed SRID value, and not a mixed SRID.
      Parameters:
      gt - (undocumented)
      Returns:
      (undocumented)