Handle the data source of KML markup language (Keyhole Markup Language). KML supports loading 3D models in S3M and glTF formats.
Example:
var viewer = new SuperMap3D.Viewer('Container');
viewer.dataSources.add(SuperMap3D.KmlDataSource.load('../../SampleData/facilities.kmz'),
{
camera: viewer.scene.camera,
canvas: viewer.scene.canvas
});
See:
Members
-
changedEvent : Event
-
Get an event to be fired when the underlying data changes.
-
clock : DataSourceClock
-
Get the clock settings defined by the loaded KML. Indicates the availability interval for all time dynamic data. The value is undefined if the KML does not contain temporal dynamic data.
-
clustering : EntityCluster
-
Gets or sets the class options for the data source. Can be shared between multiple data sources.
-
credit : Credit
-
Get data source credentials
-
entities : EntityCollection
-
get
Entity
instance collection -
errorEvent : Event
-
Gets the event that will be raised when an error is encountered during processing.
-
Gets a value indicating whether the current data source is loading data.
-
loadingEvent : Event
-
Gets the event that will be raised when the data source starts or stops loading.
-
Get the human-readable name of the instance. Will be automatically set to the loaded KML file name.
-
refreshEvent : Event
-
Gets the event raised when the data source refreshes the network link.
-
Gets whether the data source should be displayed.
-
unsupportedNodeEvent : Event
-
Gets the event raised when the data source finds an unsupported node type.
Methods
-
staticSuperMap3D.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 objects canvas
Canvas canvas object。 Returns:
After the import is complete, a KmlDataSource instance is returned. -
staticSuperMap3D.KmlDataSource.load(data, options) → Promise.<KmlDataSource>
-
Asynchronously loads the provided KML data, replacing any existing data.
Name Type Description data
String | Document | Blob Layer URL or BLOB containing the KML parsed document. options
Object optional The object has the following properties: Name Type Default Description camera
Camera camera object canvas
Canvas Canvas object. sourceUri
String optional Overrides urls used for resolving relative links and other KML web features. clampToGround
Boolean false
optional If we want to anchor geometric features (polygons, linestrings, and linear rings) to the ground, then true。 ellipsoid
Ellipsoid Ellipsoid.WGS84
optional A global ellipsoid for geocomputing. credit
Credit | String optional Credentials for the data source, displayed on the canvas. Returns:
Returns a KmlDataSource instance when the KML is loaded. -
Gets the visibility of the corresponding viewport of the layer.
Name Type Description index
Number index Returns:
visibleThrows:
-
DeveloperError : index value range in 0~3。
-
-
load(data, options) → Promise.<KmlDataSource>
-
Load a KML layer as a URL.
Name Type Description data
String | Document | Blob Layer URL or BLOB containing the KML parsed document. options
Object optional The object has the following properties: Name Type Description camera
Camera camera object. canvas
Canvas canvas object Returns:
Returns a KmlDataSource instance when the KML is loaded. -
Sets the visibility of the layer corresponding to the viewport.
Name Type Description index
Number index visible
Boolean visibility Throws:
-
DeveloperError : index value range in 0~3。
-
-
Update all web links that need to be updated.
Name Type Description time
JulianDate Simulation time. true if the data source is displayed within the specified time, otherwise false.