KmlDataSource - Cesium Documentation

# KmlDataSource

#### new KmlDataSource(proxy)

  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 support. 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.

  Name | Type | Description
  --- | --- | ---
  `proxy` | DefaultProxy | optional A proxy to be used for loading external data.

  ##### Example:

      var viewer = new Cesium.Viewer('cesiumContainer');
      viewer.dataSources.add(Cesium.KmlDataSource.load('../../SampleData/facilities.kmz'));

  ##### Demo:

  - Cesium Sandcastle KML Demo

  ##### See:

  - Open Geospatial Consortium KML Standard
  - Google KML Documentation
  Source: DataSources/KmlDataSource.js, line 1673

### Members

#### changedEvent :Event

  Gets an event that will be raised when the underlying data changes.
  Source: DataSources/KmlDataSource.js, line 1750

#### clock :DataSourceClock

  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.
  Source: DataSources/KmlDataSource.js, line 1720

#### entities :EntityCollection

  Gets the collection of `Entity` instances.
  Source: DataSources/KmlDataSource.js, line 1730

#### errorEvent :Event

  Gets an event that will be raised if an error is encountered during processing.
  Source: DataSources/KmlDataSource.js, line 1760

#### isLoading :Boolean

  Gets a value indicating if the data source is currently loading data.
  Source: DataSources/KmlDataSource.js, line 1740

#### loadingEvent :Event

  Gets an event that will be raised when the data source either starts or stops loading.
  Source: DataSources/KmlDataSource.js, line 1770

#### name :String

  Gets a human-readable name for this instance. This will be automatically be set to the KML document name on load.
  Source: DataSources/KmlDataSource.js, line 1708

### Methods

#### staticKmlDataSource.load(data, options) → Promise.<KmlDataSource>

  Creates a Promise to a new instance loaded with the provided KML data.

  Name | Type | Description
  --- | --- | ---
  `data` | String | Document | Blob | A url, parsed KML document, or Blob containing binary KMZ data or a parsed KML document.

  `options`

  Object

  optional An object with the following properties:

  Name | Type | Description
  --- | --- | ---
  `proxy` | DefaultProxy | optional A proxy to be used for loading external data.
  `sourceUri` | String | optional Overrides the url to use for resolving relative links and other KML network features.

  ##### Returns:

  A promise that will resolve to a new KmlDataSource instance once the KML is loaded.
  Source: DataSources/KmlDataSource.js, line 1695

#### load(data, options) → Promise.<KmlDataSource>

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

  Name | Type | Description
  --- | --- | ---
  `data` | String | Document | Blob | A url, parsed KML document, or Blob containing binary KMZ data or a parsed KML document.

  `options`

  Object

  optional An object with the following properties:

  Name | Type | Description
  --- | --- | ---
  `sourceUri` | Number | optional Overrides the url to use for resolving relative links and other KML network features.

  ##### Returns:

  A promise that will resolve to this instances once the KML is loaded.
  Source: DataSources/KmlDataSource.js, line 1785