KmlDataSource

external class KmlDataSource(options: KmlDataSource.ConstructorOptions? = definedExternally)(source)

A DataSource which processes Keyhole Markup Language 2.2 (KML).

KML support in Cesium is incomplete, but a large amount of the standard, as well as Google's gx extension namespace, is supported. See Github issue #873 for a detailed list of what is and isn't supported. Cesium will also write information to the console when it encounters most unsupported features.

Non visual feature data, such as atom:author and ExtendedData is exposed via an instance of KmlFeatureData, which is added to each Entity under the kml property.

const viewer = new Viewer('cesiumContainer');
viewer.dataSources.add(KmlDataSource.load('../../SampleData/facilities.kmz',
{
camera: viewer.scene.camera,
canvas: viewer.scene.canvas
})
);

See also

Constructors

Link copied to clipboard
constructor(options: KmlDataSource.ConstructorOptions? = definedExternally)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
sealed interface ConstructorOptions

Options for constructing a new KmlDataSource, or calling the static load method.

Properties

Link copied to clipboard

The position and orientation of this Camera will be used to populate various camera parameters when making network requests. Camera movement will determine when to trigger NetworkLink refresh if viewRefreshMode is onStop.

Link copied to clipboard

The current size of this Canvas will be used to populate the Link parameters for client height and width.

Link copied to clipboard

Gets an event that will be raised when the underlying data changes.

Link copied to clipboard

Gets the clock settings defined by the loaded KML. This represents the total availability interval for all time-dynamic data. If the KML does not contain time-dynamic data, this value is undefined.

Link copied to clipboard

Gets or sets the clustering options for this data source. This object can be shared between multiple data sources.

Link copied to clipboard

Gets the credit that will be displayed for the data source

Link copied to clipboard

Gets the collection of Entity instances.

Link copied to clipboard

Gets an event that will be raised if an error is encountered during processing.

Link copied to clipboard

Gets a value indicating if the data source is currently loading data.

Link copied to clipboard

Gets the KML Tours that are used to guide the camera to specified destinations on given time intervals.

Link copied to clipboard

Gets an event that will be raised when the data source either starts or stops loading.

Link copied to clipboard

Gets or sets a human-readable name for this instance. This will be automatically be set to the KML document name on load.

Link copied to clipboard

Gets an event that will be raised when the data source refreshes a network link.

Link copied to clipboard

Gets whether or not this data source should be displayed.

Link copied to clipboard

Gets an event that will be raised when the data source finds an unsupported node type.

Functions

Link copied to clipboard
fun destroy()

Cleans up any non-entity elements created by the data source. Currently this only affects ScreenOverlay elements.

Link copied to clipboard
suspend fun load(data: Resource, options: KmlDataSource.Companion.LoadOptions? = definedExternally): KmlDataSource

Asynchronously loads the provided KML data, replacing any existing data.

suspend fun load(data: String, options: KmlDataSource.Companion.LoadOptions? = definedExternally): KmlDataSource
suspend fun load(data: Blob, options: KmlDataSource.Companion.LoadOptions? = definedExternally): KmlDataSource
suspend fun load(data: Document, options: KmlDataSource.Companion.LoadOptions? = definedExternally): KmlDataSource
Link copied to clipboard
fun loadAsync(data: Resource, options: KmlDataSource.Companion.LoadOptions? = definedExternally): Promise<KmlDataSource>
fun loadAsync(data: String, options: KmlDataSource.Companion.LoadOptions? = definedExternally): Promise<KmlDataSource>
fun loadAsync(data: Blob, options: KmlDataSource.Companion.LoadOptions? = definedExternally): Promise<KmlDataSource>
fun loadAsync(data: Document, options: KmlDataSource.Companion.LoadOptions? = definedExternally): Promise<KmlDataSource>
Link copied to clipboard

Updates any NetworkLink that require updating.