Represents a KML Model for a given URI. The KML model will be decoded asynchronously and lazily when needed. This KML Model is decoded just before it is painted. The model is read only; only the query method is supported. The FeatureModel.put, FeatureModel.spatialQuery methods are not supported.

Note that, internally, the KMLModel uses the KMLCodec.

Hierarchy

Implements

Constructors

  • Creates a KML Model.

    Parameters

    • uri: string

      An URI to the KML or KMZ file. This can be either a relative or an absolute reference.

    Returns KMLModel

Accessors

  • get bounds(): null | Bounds
  • The spatial extent of the data in this model. If the property is null, the extent is unknown.

    Returns null | Bounds

  • get coordinateType(): CoordinateType
  • The coordinate type of geometries in this model.

    Returns CoordinateType

  • get modelDescriptor(): ModelDescriptor
  • The model descriptor of this model. The model descriptor object becomes immutable (frozen) when passed to the setter.

    Returns ModelDescriptor

  • set modelDescriptor(modelDescriptor): void
  • An object containing metadata about this model

    Parameters

    Returns void

  • get reference(): CoordinateReference
  • The spatial reference in which this object is defined. If this property is null then this object is not spatially referenced.

    Returns CoordinateReference

Methods

  • Add a feature to the model. Note that this function will only be available if the underlying store also provides an add function.

    Parameters

    • feature: Feature<null | Shape, FeatureProperties>

      The feature to add to the model.

    • Optional options: any

      Object literal that will be passed as is to the model's store.

    Returns FeatureId | Promise<FeatureId>

    Returns the identifier of the feature, or a promise for the identifier.

  • Update an existing feature in the model object. Note that this function will only be available if the underlying store also provides a put function.

    Parameters

    • feature: Feature<null | Shape, FeatureProperties>

      The feature to update.

    • Optional options: any

      Object literal that will be passed as is to the model's store.

    Returns FeatureId | Promise<FeatureId>

    Returns the identifier of the feature, or a promise for the identifier.

  • Removes a feature from the model by id. Note that this function will only be available if the underlying store also provides a remove function.

    Parameters

    Returns boolean | Promise<boolean>

    true or promise for true on successful removal, otherwise false.

Events

"ModelChanged" event

  • on("ModelChanged", callback: ((modelChangeType, feature, id) => void), context?: any) : Handle
  • Note: the FeatureModel requires a Store which supports events in order to automatically fire ModelChanged events. When the store does not support events, it is up to the user of this class to fire those events manually.

    Parameters

    • event: "ModelChanged"

      The "ModelChanged" event type

    • callback: ((modelChangeType, feature, id) => void)

      the feature that was added, updated or removed. In case of remove events, this may be undefined.

    • Optional context: any

      the context in which the callback function should be invoked. implementation dependent.

      An event that is emitted when the contents of the model changes.

      "ModelChanged"

    Returns Handle

"KMLNetworkLink" event

  • on("KMLNetworkLink", callback: ((networkLink) => void), context?: any) : Handle
  • Registers a callback function for the "KMLNetworkLink" event to process KMLNetworkLinks.

    Parameters

    • event: "KMLNetworkLink"

      Always set to "KMLNetworkLink" for this event type.

    • callback: ((networkLink) => void)

      The callback function to be executed when the NetworkLink cursor is decoded by the KMLCodec.decode function.

    • Optional context: any

      The context in which the callback function should be invoked.

      "KMLNetworkLink"

    Returns Handle

"KMLTree" event

  • on("KMLTree", callback: ((rootArray) => void), context?: any) : Handle
  • Registers a callback function for the "KMLTree" event. The callback function receives an array of KMLFeatures.

    Parameters

    • event: "KMLTree"

      Always set to "KMLTree" for this event type.

    • callback: ((rootArray) => void)

      The callback function to be executed when the KMLCodec.decode function is called.

    • Optional context: any

      The context in which the function should be invoked.

      "KMLTree"

    Returns Handle

"KMLGroundOverlay" event

  • on("KMLGroundOverlay", callback: ((groundOverlay) => void), context?: any) : Handle
  • Registers a callback function for the "KMLGroundOverlay" event, that allows a listener to process KML ground overlays.

    Parameters

    • event: "KMLGroundOverlay"

      Always set to "KMLGroundOverlay" for this event type.

    • callback: ((groundOverlay) => void)

      The callback function to be executed when the KMLCodec.decode function is called.

    • Optional context: any

      The context in which the function should be invoked.

      "KMLGroundOverlay"

    Returns Handle

"KMLScreenOverlay" event

  • on("KMLScreenOverlay", callback: ((screenOverlay) => void), context?: any) : Handle
  • Registers a callback function for the "KMLScreenOverlay" event, that allows a listener to process KML ground overlays.

    Parameters

    • event: "KMLScreenOverlay"

      Always set to "KMLScreenOverlay" for this event type.

    • callback: ((screenOverlay) => void)

      The callback function to be executed when the KMLCodec.decode function is called.

    • Optional context: any

      The context in which the function should be invoked.

      "KMLScreenOverlay"

    Returns Handle

    Since

    2021.0

"KMLFatalError" event

  • on("KMLFatalError", callback: ((errorMessage) => void), context?: any) : Handle
  • Registers a callback function for the "KMLFatalError" event, that allows a listener to process errors which cause the KMLCodec to abort operations.

    Parameters

    • event: "KMLFatalError"

      Always set to "KMLFatalError" for this event type.

    • callback: ((errorMessage) => void)

      The callback function to be executed when the KMLCodec encounters a fatal error.

        • (errorMessage): void
        • Parameters

          • errorMessage: string

          Returns void

    • Optional context: any

      The context in which the function should be invoked.

      "KMLFatalError"

    Returns Handle

    Since

    2021.0