Creates a KML codec that can decode KML 2.3 strings.
Optional
options: KMLCodecConstructorOptionsan object literal that contains configuration settings for the codec.
2020.1
Converts content from a string, ArrayBuffer, or Blob into a cursor of KMLPlacemarkFeatures KMLGroundOverlayFeatures.
KML Network Link elements are emitted as KMLNetworkLinkFeature objects with the "KMLNetworkLink" event. KML Ground Overlay elements are emitted as KMLGroundOverlayFeature objects with the "KMLGroundOverlay" event. KML Screen overlay elements are emitted as KMLScreenOverlayFeature objects with the "KMLScreenOverlay" event.
The content to decode. Note that CodecDecodeOptions.reference will be ignored, as the KML specification stipulates that all KML coordinates should be interpreted using WGS 84. The CodecDecodeOptions.contentType is also unnecessary, and the codec will automatically determine whether the content is a KMZ that must be uncompressed before attempting to parse it. If the content is a KMZ file, then it will be uncompressed in memory and then parsed as a KML file. Bundled image resources in a KMZ file are also processed. Supported bundled image formats: '.png', '.jpeg', '.gif' and '.tiff'.
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.
Optional
context: 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.
Optional
context: 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.
Optional
context: 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.
Optional
context: 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"
2021.0
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.
Optional
context: anyThe context in which the function should be invoked.
"KMLFatalError"
2021.0
Decodes KML and KMZ files (strings, ArrayBuffers, and Blobs) into a KMLPlacemarkFeatures, KMLGroundOverlayFeatures. Other features are emitted from events:
"KMLNetworkLink"
event. Network Links are separate KML Files that should be decoded separately in a new LuciadRIA model and layer (e.g. KMLModel and KMLLayer."KMLGroundOverlay"
event. Ground Overlays should be handled in a layer, cf createGroundOverlayLayer."KMLTree"
event. These features are used to represent the structure of the KML file, complete with the traversed KMLScreenOverlayFeatures and KMLGroundOverlayFeatures. These "container" features are not rendered on the map, and are used to facilitate the creation of a GUI.A
KMLCodec
is typically used by a Store to decode strings into LuciadRIAKMLFeature
s. Consult the class documentation of theStore
class for more information.Styles are resolved according to the KML specification, as long as they are defined in the original KML file. Externally referenced styles are not resolved.
Supported versions
The current version of LuciadRIA supports the KML 2.3 standard.
Limitations
NOTE: This codec only handles well-formed, serialized KML documents and does not handle extensions to the KML Specification.
Since
2020.1