Class Geography

java.lang.Object
org.apache.sedona.common.S2Geography.Geography
Direct Known Subclasses:
EncodedShapeIndexGeography, GeographyCollection, PointGeography, PolygonGeography, PolylineGeography, ShapeIndexGeography

public abstract class Geography extends Object
An abstract class represent S2Geography. Has 6 subtypes of geography: POINT, POLYLINE, POLYGON, GEOGRAPHY_COLLECTION, SHAPE_INDEX, ENCODED_SHAPE_INDEX.
  • Field Details

  • Constructor Details

  • Method Details

    • setSRID

      public void setSRID(int srid)
    • getSRID

      public int getSRID()
    • getKind

      public int getKind()
    • dimension

      public abstract int dimension()
      Returns:
      0, 1, or 2 if all Shape()s that are returned will have the same dimension (i.e., they are all points, all lines, or all polygons).
    • computeDimensionFromShapes

      protected final int computeDimensionFromShapes()
      Usage of checking all shapes in side collection geography
      Returns:
    • numShapes

      public abstract int numShapes()
      Returns:
      The number of S2Shape objects needed to represent this Geography
    • shape

      public abstract com.google.common.geometry.S2Shape shape(int id)
      Returns the given S2Shape (where 0 <= id < num_shapes()). The caller retains ownership of the S2Shape but the data pointed to by the object requires that the underlying Geography outlives the returned object.
      Parameters:
      id - (where 0 <= id < num_shapes())
      Returns:
      the given S2Shape
    • region

      public abstract com.google.common.geometry.S2Region region()
      Returns an S2Region that represents the object. The caller retains ownership of the S2Region but the data pointed to by the object requires that the underlying Geography outlives the returned object.
      Returns:
      S2Region
    • getCellUnionBound

      public void getCellUnionBound(List<com.google.common.geometry.S2CellId> cellIds)
      Adds an unnormalized set of S2CellIDs to `cell_ids`. This is intended to be faster than using Region().GetCovering() directly and to return a small number of cells that can be used to compute a possible intersection quickly.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(org.locationtech.jts.geom.PrecisionModel precisionModel)
    • toText

      public String toText(org.locationtech.jts.geom.PrecisionModel precisionModel)
    • toEWKT

      public String toEWKT()
    • toEWKT

      public String toEWKT(org.locationtech.jts.geom.PrecisionModel precisionModel)
    • encodeTagged

      public void encodeTagged(OutputStream os, EncodeOptions opts) throws IOException
      Serialize this geography to an encoder. This does not include any encapsulating information (e.g., which geography type or flags). Encode this geography into a stream as: 1) a 5-byte EncodeTag header (see EncodeTag encode / decode) 2) coveringSize × 8-byte cell-ids 3) the raw shape payload (point/polyline/polygon) via the built-in coder
      Parameters:
      opts - CodingHint.FAST / CodingHint.COMPACT / Include or omit the cell‐union covering prefix
      Throws:
      IOException
    • decodeTagged

      public static Geography decodeTagged(InputStream is) throws IOException
      Throws:
      IOException
    • decode

      public static Geography decode(com.esotericsoftware.kryo.io.UnsafeInput in, EncodeTag tag) throws IOException
      Throws:
      IOException
    • encode

      public abstract void encode(com.esotericsoftware.kryo.io.UnsafeOutput os, EncodeOptions opts) throws IOException
      Throws:
      IOException