Process the datasource of KML markup language (Keyhole Markup Language). KML supports loading of 3D models in S3M and glTF formats.
Example:
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.dataSources.add(Cesium.KmlDataSource.load('../../SampleData/facilities.kmz'),
{
camera: viewer.scene.camera,
canvas: viewer.scene.canvas
});
See:
Members
-
changedEvent : Event
-
Get the event that will be triggered when the underlying data changes.
-
clock : DataSourceClock
-
Get the clock setting defined by the loaded KML. Represents the availability interval of dynamic data at all times. If KML does not contain time dynamic data, the value is undefined.
-
clustering : EntityCluster
-
Gets or sets the class options of the datasource. Can be shared between multiple datasources.
-
entities : EntityCollection
-
Get the collection of
Entity
instances. -
errorEvent : Event
-
Get the event that will be raised when an error is encountered during processing.
-
Get a value that shows whether the current datasource is loading data.
-
loadingEvent : Event
-
Get the event that will be raised when the datasource starts or stops loading.
-
Get the human-readable name of the instance. It will be automatically set as the name of the loaded KML file.
-
refreshEvent : Event
-
Get the event raised when the datasource refreshes the network link.
-
Get whether the datasource should be displayed.
-
unsupportedNodeEvent : Event
-
Get the event raised when the datasource finds an unsupported node type.
Methods
-
staticCesium.KmlDataSource.importFile(data, options) → Promise.<KmlDataSource>
-
Import local KML files.
Name Type Description data
String KML file storage path. options
Object optional The object has the following properties: Name Type Description camera
Camera Camera object. canvas
Canvas canvas object. Returns:
After the import is complete, a KmlDataSource instance is returned. -
Get the visibility of the viewport corresponding to the layer.
Name Type Description index
Number index. Returns:
visible (optional).Throws:
-
DeveloperError : The index value range is 0~3.
-
-
load(data, options) → Promise.<KmlDataSource>
-
Load the KML layer as a URL.
Name Type Description data
String | Document | Blob Layer URL or BLOB containing KML parsed document. options
Object optional The object has the following properties: Name Type Description camera
Camera Camera object. canvas
Canvas canvas object. Returns:
When KML is loaded, a KmlDataSource instance is returned. -
Set the visibility of the corresponding viewport of the layer.
Name Type Description index
Number Index. visible
Boolean Visible (optional) Throws:
-
DeveloperError : The index value range is 0~3.
-
-
Update all network links that need to be updated.
Name Type Description time
JulianDate Simulation time. It is true if the datasource is displayed within the specified time, otherwise it is false.