Geo¶
@Serializable(with = Geo.Serializer::class)
sealed class Geo : BsonFieldWriteable
GeoJSON types supported by MongoDB.
Our goal is to represent the GeoJSON RFC, as it is implemented by MongoDB. MongoDB does not support large sections of the RFC, so we won't support them either.
GeoJSON operators calculate on a sphere, using the WGS84 reference system.
External resources¶
Inheritors¶
Types¶
CoordinateReferenceSystem¶
data class CoordinateReferenceSystem(val name: String)
A coordinate reference system (CRS) represents the way points are projected.
GeometryCollection¶
@Serializable(with = Geo.GeometryCollection.Serializer::class)
data class GeometryCollection(val geometries: List<Geo>) : Geo
A GeoJSON geometry collection.
Latitude¶
LineString¶
@Serializable(with = Geo.LineString.Serializer::class)
data class LineString(val points: List<Geo.Point>) : Geo
A GeoJSON line string.
Longitude¶
MultiLineString¶
@Serializable(with = Geo.MultiLineString.Serializer::class)
data class MultiLineString(val lineStrings: List<Geo.LineString>) : Geo
A GeoJSON MultiLineString.
MultiPoint¶
@Serializable(with = Geo.MultiPoint.Serializer::class)
data class MultiPoint(val points: List<Geo.Point>) : Geo
A GeoJSON MultiPoint.
MultiPolygon¶
@Serializable(with = Geo.MultiPolygon.Serializer::class)
data class MultiPolygon(val polygons: List<Geo.Polygon>) : Geo
A GeoJSON MultiPolygon.
Point¶
@Serializable(with = Geo.Point.Serializer::class)
data class Point(val x: Geo.Longitude, val y: Geo.Latitude) : Geo
A GeoJSON point.
Polygon¶
@Serializable(with = Geo.Polygon.Serializer::class)
data class Polygon(val rings: List<Geo.LineString>) : Geo
A GeoJSON polygon.
Serializer¶
@LowLevelApi
object Serializer : KSerializer<Geo>
Functions¶
toString¶
JSON representation of this object as a BSON document.
writeTo¶
@LowLevelApi
abstract fun writeTo(writer: BsonFieldWriter)
Writes this object to the provided writer.