Creates a KML codec that can decode KML 2.3 strings.
Optionaloptions: KMLCodecConstructorOptionsan object literal that contains configuration settings for the codec.
Decodes KML content (string, ArrayBuffer, or Blob) into a cursor of KMLFeature.
The cursor yields KMLPlacemarkFeature and KMLGroundOverlayFeature instances.
Other feature types are emitted as events:
The content to decode.
.png, .jpeg, .gif, .tiff).A Cursor of KMLFeature, or a Promise resolving to one for asynchronous inputs (for example, KMZ/Blob)
This is not yet implemented and will throw a ProgrammingError if it is used.
Defines the KMLFeatures to be encoded.
The encoded version of the features.
Registers a callback function for the "KMLNetworkLink" event to process KMLNetworkLinkFeatures.
This event is fired by the cursor when it identifies a <NetworkLink> element in
the document.
Always set to "KMLNetworkLink" for this event type.
The callback function to be executed when KMLNetworkLinkFeature objects are decoded by the KMLCodec.decode function.
Optionalcontext: anyThe context in which the callback function should be invoked.
"KMLNetworkLink"
Registers a callback function for the "KMLTree" event. The callback function receives an array of KMLFeatures. This event is fired when the cursor has finished processing, and contains all of the previously processed and emitted nodes from that cursor.
Always set to "KMLTree" for this event type.
The callback function to be executed when the KMLCodec.decode function is called.
Optionalcontext: anyThe context in which the function should be invoked.
"KMLTree"
Registers a callback function for the "KMLGroundOverlay" event, that allows a listener to process
KMLGroundOverlayFeatures. This event is triggered by the cursor whenever it identifies a
<GroundOverlay> element in the document.
Always set to "KMLGroundOverlay" for this event type.
The callback function to be executed when the KMLCodec.decode function is called.
Optionalcontext: anyThe context in which the function should be invoked.
"KMLGroundOverlay"
Registers a callback function for the "KMLScreenOverlay" event, that allows a listener to process
KMLScreenOverlayFeatures. This event is triggered by the cursor whenever it identifies a
<ScreenOverlay> element in the document.
Always set to "KMLScreenOverlay" for this event type.
The callback function to be executed when the KMLCodec.decode function is called.
Optionalcontext: anyThe context in which the function should be invoked.
a handle to the registered callback with a single function 'remove'. This function can be used to unregister the callback function.
"KMLScreenOverlay"
Registers a callback function for the "KMLFatalError" event, that allows a listener to process errors which cause the KMLCodec to abort operations.
Always set to "KMLFatalError" for this event type.
The callback function to be executed when the KMLCodec encounters a fatal error.
Optionalcontext: anyThe context in which the function should be invoked.
"KMLFatalError"
Decodes KML and KMZ files (strings, ArrayBuffers, and Blobs) into KMLPlacemarkFeature and KMLGroundOverlayFeature instances. Other features are emitted from events:
"KMLNetworkLink"event. Network Links reference separate KML files that should be decoded in a new LuciadRIA model and layer, for example KMLModel and KMLLayer."KMLGroundOverlay"event. Ground Overlays should be handled in a layer (see createGroundOverlayLayer)."KMLTree"event. These features are used to represent the structure of the KML file, including traversed KMLScreenOverlayFeatures and KMLGroundOverlayFeatures. These "container" features are not rendered on the map. They exist to facilitate GUI creation.A
KMLCodecis typically used by a Store to decode strings into LuciadRIAKMLFeatures. Consult the class documentation of theStoreclass for more information.Styles defined in the source KML are resolved according to the KML specification. Externally referenced styles are not resolved.
Supported versions
The current version of LuciadRIA supports the KML 2.3 standard.
This codec decodes only the following features:
Data,SchemaDataand foreign-namespace elements)Limitations
schemaUrlreferences in the same file are supported (e.g.#S1points to the local<Schema id="S1">).NOTE: This codec only handles well-formed, serialized KML documents and does not process extensions to the KML Specification.
Since
2020.1