Feature

@Serializable(with = FeatureSerializer::class)
data class Feature<out T : Geometry>(val geometry: T?, val properties: Map<String, Any> = emptyMap(), val id: String? = null, val bbox: BoundingBox? = null, val foreignMembers: Map<String, Any> = emptyMap()) : GeoJson

A feature object represents a spatially bounded thing.

See also

Constructors

Link copied to clipboard
constructor(geometry: T?, properties: Map<String, Any> = emptyMap(), id: String? = null, bbox: BoundingBox? = null, foreignMembers: Map<String, Any> = emptyMap())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val bbox: BoundingBox? = null

An optional bounding box used to represent the limits of the object's geometry.

Link copied to clipboard
open override val foreignMembers: Map<String, Any>

Members not described by specification ("foreign members") MAY be used in a GeoJSON document. NOTE: Every custom type, which is added as a value will be represented also as a Map<String, Any>. If deserialization of custom types are desired, this hast to be done by consumer.

Link copied to clipboard
val geometry: T?

A Geometry object contained within the feature.

Link copied to clipboard
val id: String? = null

An optionally included string that commonly identifies this feature.

Link copied to clipboard

Additional properties about this feature. When serialized, any non-simple types will be serialized into JSON objects.

Functions

Link copied to clipboard
@JvmName(name = "getNonNullableGeometry")
inline fun getGeometry(): T

Returns the geometry or throws an exception if it is null.

Link copied to clipboard
@JvmName(name = "getPropertyCast")
inline fun <T> getProperty(key: String): T?

Gets the value of the property with the given key.

Link copied to clipboard
open override fun json(): String

Gets a JSON representation of this object.

Link copied to clipboard
open override fun toString(): String