Class Geography
java.lang.Object
org.apache.sedona.common.S2Geography.Geography
- Direct Known Subclasses:
EncodedShapeIndexGeography,GeographyCollection,PointGeography,PolygonGeography,PolylineGeography,ShapeIndexGeography
An abstract class represent S2Geography. Has 6 subtypes of geography: POINT, POLYLINE, POLYGON,
GEOGRAPHY_COLLECTION, SHAPE_INDEX, ENCODED_SHAPE_INDEX.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final intUsage of checking all shapes in side collection geographystatic Geographystatic Geographyabstract intabstract voidencode(com.esotericsoftware.kryo.io.UnsafeOutput os, EncodeOptions opts) voidencodeTagged(OutputStream os, EncodeOptions opts) Serialize this geography to an encoder.voidgetCellUnionBound(List<com.google.common.geometry.S2CellId> cellIds) Adds an unnormalized set of S2CellIDs to `cell_ids`.intgetKind()intgetSRID()abstract intabstract com.google.common.geometry.S2Regionregion()Returns an S2Region that represents the object.voidsetSRID(int srid) abstract com.google.common.geometry.S2Shapeshape(int id) Returns the given S2Shape (where 0 <= id < num_shapes()).toEWKT()toEWKT(org.locationtech.jts.geom.PrecisionModel precisionModel) toString()toString(org.locationtech.jts.geom.PrecisionModel precisionModel) toText(org.locationtech.jts.geom.PrecisionModel precisionModel)
-
Field Details
-
kind
-
-
Constructor Details
-
Geography
-
-
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
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
-
toString
-
toText
-
toEWKT
-
toEWKT
-
encodeTagged
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
- 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
-