Options
All
  • Public
  • Public/Protected
  • All
Menu

A KML Layer that can visualize KML Models in a LuciadRIA Map.

A KML Layer is a layer that is capable of visualizing OGC KML 2.3 Models.

Only placemark features are visualized, that contain any of the following geometry:

  • Points
  • LineString
  • LinearRing
  • Polygon
  • MultiGeometry
  • Models are converted to Points

The layer's default painter draws placemark features taking into account KML styles that are encoded into placemark features.

If selection is enabled on the layer, you can select a feature to have it generate a balloon. Note that balloons are only generated if the feature contains a description. The balloon can have static HTML content.

In 3D maps, shapes are draped when the altitudeMode property for the geometry in the KML file equals "clampToGround" or "relativeToGround". The drapeTarget determines the target of the draped KML content, TERRAIN (default) or MESH.

In order for a feature to be visible, the visibility element in KML data must be set to 1. You can control visibility of loaded KML features by changing the KMLFeatureProperties.visibility property.

Limitations:

  • Level-of-Detail elements (i.e. Region), and other view-based attributes, are not used for painting.

Hierarchy

Implements

Overview

Constructors

constructor

  • Creates a new KML Layer that can visualize KML Models in a LuciadRIA Map.

    Parameters

    • kmlModel: FeatureModel

      A model containing KML data.

    • Optional options: KMLLayerConstructorOptions

      The options for this layer. If no painter is set in these options, the KML will use a custom built-in painter to paint KML features, adhering to the style information in the KML file.

    Returns KMLLayer

Events

on

  • (event: string, callback: (...args: any[]) => void, context?: any): Handle
  • (event: "EditableChanged", callback: (editable: boolean) => void, context?: any): Handle
  • Parameters

    • event: string
    • callback: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns Handle

  • Event fired when the editability of the layer changes.

    Parameters

    • event: "EditableChanged"

      the 'EditableChanged' changed event.

    • callback: (editable: boolean) => void

      the callback to be invoked when the editability of the layer changes. The callback gets the 'editable' boolean parameter, which indicates whether or not the layer is editable.

        • (editable: boolean): void
        • Parameters

          • editable: boolean

          Returns void

    • Optional context: any

      value to use as this when executing callback

    Returns Handle

Properties

isSnapTarget

isSnapTarget: boolean

Accessors

balloonContentProvider

  • get balloonContentProvider(): (obj: Feature | Shape) => string | HTMLElement
  • set balloonContentProvider(balloonContentProvider: (obj: Feature | Shape) => string | HTMLElement): void
  • The content provider that may be used when Map.showBalloon is called on the map. The content provider is a function that takes a single parameter and returns the contents for the balloon. The parameter is the object for which the balloon is shown, which is typically a Feature. The return value of the function can be a string or a DOM-node.

    See Map.showBalloon for information on how to style the balloon.

    Returns (obj: Feature | Shape) => string | HTMLElement

  • The content provider that may be used when Map.showBalloon is called on the map. The content provider is a function that takes a single parameter and returns the contents for the balloon. The parameter is the object for which the balloon is shown, which is typically a Feature. The return value of the function can be a string or a DOM-node.

    See Map.showBalloon for information on how to style the balloon.

    Parameters

    Returns any

bounds

  • get bounds(): Bounds | undefined
  • The bounds of the layer (read-only). This is the bounds of all the objects that are currently in this layer's workingSet. The return value is undefined when no objects are shown.


    Note that this bounds includes all features that are currently in the working set. If there is a FeatureLayer.filter on the layer, this means that the bounds may be bigger than what is actually visible on the screen.

    In order to get the bounds that applies only to the features that pass the filter, you can use the below utility function.

     function calculateFilteredBounds(layer) {
        var boundsArray = layer.workingSet.get()
                                    .filter(layer.filter)
                                    .map(function(feature) { return feature.shape.bounds; });
         if (boundsArray.length !== 0) {
             return boundsArray.reduce(function(previousValue, currentValue) {
                   previousValue.setTo2DUnion(currentValue);
                   return previousValue;
              }, boundsArray[0].copy());
         } else {
             return;
         }
     }
    

    Returns Bounds | undefined

children

  • The list of direct children of the node. The children are ordered according to the painting order (the bottom layer is the first element in the array). Note that also the nodes that are not visible will be included.

    Returns LayerTreeNode[]

drapeTarget

  • The target on which KML draped content will be draped. By default, this is the terrain.

    since

    2022.1

    Returns DrapeTarget

editable

  • get editable(): boolean
  • set editable(editable: boolean): void

filter

  • Get or set the layer's filter function. This is a predicate function, a plain javascript function which must return either true or false. The argument of this function is a Feature contained in the workingSet.

    If the feature does not pass the test of the filter function, the feature will not be visualized on the map. Selected objects which do not pass the filter will be deselected.

    Even though features may fail the filter-test, they still remain present in the layer's workingSet. To exclude features from the workingSet, use model-based filtering.

    For performance reasons, the result of the function is cached. This means that the filter function must be idempotent: for identical input, the function must return the same boolean value. In practice, this means that the function should not depend on mutable global state. If there is a state-change during the runtime of the application which requires that the filter function must be re-evaluated, simply reset the filter on the layer.

    Note that you can also use OGCConditions as a filter. In order to do so, first convert the condition to a function with FilterFactory.toFeaturePredicate.

    Returns FilterPredicateType | null

  • Get or set the layer's filter function. This is a predicate function, a plain javascript function which must return either true or false. The argument of this function is a Feature contained in the workingSet.

    If the feature does not pass the test of the filter function, the feature will not be visualized on the map. Selected objects which do not pass the filter will be deselected.

    Even though features may fail the filter-test, they still remain present in the layer's workingSet. To exclude features from the workingSet, use model-based filtering.

    For performance reasons, the result of the function is cached. This means that the filter function must be idempotent: for identical input, the function must return the same boolean value. In practice, this means that the function should not depend on mutable global state. If there is a state-change during the runtime of the application which requires that the filter function must be re-evaluated, simply reset the filter on the layer.

    Note that you can also use OGCConditions as a filter. In order to do so, first convert the condition to a function with FilterFactory.toFeaturePredicate.

    Parameters

    Returns any

hoverable

  • get hoverable(): boolean
  • set hoverable(enabled: boolean): void
  • Determines whether the KML layer is hoverable.

    If the hoverable state is not set explicitly by the user then the state is deduced from the underlying KML data, making the layer hoverable only when the KML data defines a different style for the normal and the highlight state.

    Returns boolean

  • Determines whether the KML layer is hoverable.

    If the hoverable state is not set explicitly by the user then the state is deduced from the underlying KML data, making the layer hoverable only when the KML data defines a different style for the normal and the highlight state.

    Parameters

    • enabled: boolean

    Returns any

id

  • get id(): string
  • The node's ID (immutable). This ID was configured at construction time and is unique over the whole layer tree. If no ID was given, a UUID will have been generated automatically.

    Returns string

label

  • get label(): string
  • set label(value: string): void
  • The node's label. This label was configured at construction time. If no label was given, the label will correspond to the layer's ID.

    Returns string

  • The node's label. This label was configured at construction time. If no label was given, the label will correspond to the layer's ID.

    Parameters

    • value: string

    Returns any

loadingStrategy

map

  • get map(): Map | null
  • The map this note is attached to, or null. This property will be null if this node is not attached to a map.

    Returns Map | null

model

painter

  • The painter used to paint the objects in the layer. The property is both readable and writable. If assigning to this property, the new value must have luciad.view.feature.FeaturePainter in its prototype chain.

    Returns FeaturePainter

  • The painter used to paint the objects in the layer. The property is both readable and writable. If assigning to this property, the new value must have luciad.view.feature.FeaturePainter in its prototype chain.

    Parameters

    Returns any

panoramaModel

parent

  • The parent of this node or null. This property will be null if this node has not been added as the child of another node yet.

    Returns LayerGroup | null

query

  • get query(): any | null
  • set query(query: any | null): void
  • The query used by this Layer. The query object is passed on to the 'query(...)' method of the model of this layer when retrieving the data to be painted. When setting this property, the FeatureLayer will automatically requery the model.

    deprecated

    Use a QueryProvider instead of using the query property.

    Use a QueryProvider to configure the query parameters that must be sent to the FeatureModel instead of using the query property.

    The simplest way to upgrade existing code to the QueryProvider approach is creating a LoadEverything data loading loading strategy that is configured with the value of the query property. See the code example.

    For additional information on loading strategies and Query Providers, please refer to the LuciadRIA developer guide.

    var myLoadingStrategy = new LoadEverything({
      query: {
        type:"human",
        firstname:"John"
      }
    });

    Returns any | null

  • The query used by this Layer. The query object is passed on to the 'query(...)' method of the model of this layer when retrieving the data to be painted. When setting this property, the FeatureLayer will automatically requery the model.

    deprecated

    Use a QueryProvider instead of using the query property.

    Use a QueryProvider to configure the query parameters that must be sent to the FeatureModel instead of using the query property.

    The simplest way to upgrade existing code to the QueryProvider approach is creating a LoadEverything data loading loading strategy that is configured with the value of the query property. See the code example.

    For additional information on loading strategies and Query Providers, please refer to the LuciadRIA developer guide.

    var myLoadingStrategy = new LoadEverything({
      query: {
        type:"human",
        firstname:"John"
      }
    });

    Parameters

    • query: any | null

    Returns any

scaleRange

  • get scaleRange(): { max: number; min: number }
  • The scale range of this layer. The scale range is an object with a 'min' and 'max' property.

    Returns { max: number; min: number }

    • max: number
    • min: number

selectable

  • get selectable(): boolean
  • set selectable(selectable: boolean): void
  • Determines whether the layer is selectable.

    Returns boolean

  • Determines whether the layer is selectable.

    Parameters

    • selectable: boolean

    Returns any

shapeProvider

  • The shape provider used by this layer. A ShapeProvider maps a model object to a shape. This shape is the geometry which is visualized by the layer. It does not necessarily have to be the same as the .shape property of a Feature. Both gettable and settable.

    Returns ShapeProvider

  • The shape provider used by this layer. A ShapeProvider maps a model object to a shape. This shape is the geometry which is visualized by the layer. It does not necessarily have to be the same as the .shape property of a Feature. Both gettable and settable.

    Parameters

    Returns any

supportedPaintRepresentations

transformer

treeNodeType

type

  • The LayerType of this layer. The layer type is used by the Map to optimize rendering. It is an optional parameter of the layer constructor.

    Returns LayerType

visible

  • get visible(): boolean
  • set visible(visible: boolean): void
  • Denotes whether the node is visible. This can be considered to be the master visibility switch: Setting this to false makes the layer entirely invisible. If it is true, the visible paint representations will be visible.

    This property does not reflect whether this node's parent is visible as well, If this is desired, use LayerTreeNode.visibleInTree instead.

    Returns boolean

  • Denotes whether the node is visible. This can be considered to be the master visibility switch: Setting this to false makes the layer entirely invisible. If it is true, the visible paint representations will be visible.

    This property does not reflect whether this node's parent is visible as well, If this is desired, use LayerTreeNode.visibleInTree instead.

    Parameters

    • visible: boolean

    Returns any

visibleInTree

  • get visibleInTree(): boolean
  • set visibleInTree(value: boolean): void
  • Denotes whether this layer is visible on the map. This method will only return true if this layer and every parent layer up to the root of the layer tree is visible.

    If visibleInTree is set to true, this will ensure that every parent LayerTreeNode up to the of the tree is configured to be visible as well.

    Returns boolean

  • Denotes whether this layer is visible on the map. This method will only return true if this layer and every parent layer up to the root of the layer tree is visible.

    If visibleInTree is set to true, this will ensure that every parent LayerTreeNode up to the of the tree is configured to be visible as well.

    Parameters

    • value: boolean

    Returns any

workingSet

  • The working set of this layer (read-only). A working set represents the objects which are being visualized by the FeatureLayer. This may be a subset of the objects which are contained within the FeatureModel of the FeatureLayer. This will be the case when the Store (either client side, or on the server) has applied a filter on the results, based on the query-parameter. This may also be the case when the FeatureLayer has not yet completed processing all objects or completed processing all model updates.

    Returns WorkingSet

Methods

accept

findLayerById

  • Returns the layer with the given ID if that layer is this node or one of its children. Note that the layer's ID does not correspond with the layer's label.

    Parameters

    • id: string

      The id of the layer that you want to retrieve.

    Returns Layer

    the requested layer or undefined if it is not present in the tree

findLayerGroupById

  • Returns the layer group with the given ID if that layer is this node or one of its children.

    since

    2014.0

    Parameters

    • id: string

      The id of the layer group that you want to retrieve.

    Returns LayerGroup

    the requested layer group or undefined if it is not present in the tree

findLayerTreeNodeById

  • Returns the layer tree node with the given ID if that layer is this node or one of its children. This may be a layer-group or a layer.

    since

    2014.0

    Parameters

    • id: string

      The id of the layerTreeNode that you want to retrieve.

    Returns LayerTreeNode

    the requested layerTreeNode or undefined if it is not present in the tree

getModelBoundsVisibleOnMap

isPaintRepresentationSupported

isPaintRepresentationVisible

isPaintRepresentationVisibleInTree

onClick

  • Called when the map has detected a single click on an object that is contained by this layer. This method can be overridden to take action when the click is detected. The default implementation of this method simply returns false.

    Parameters

    • object: Feature

      the object that was clicked on

    Returns boolean

    true to indicate that the click was handled and default behavior should not occur; false otherwise

onCreateContextMenu

  • Called when the map is going to display a context menu for an object that is contained by this layer. This method can be overridden to populate the given context menu with additional items.

    Parameters

    • contextMenu: ContextMenu

      The context menu to populate

    • map: Map

      The map that is about to show a context menu

    • contextMenuInfo: any

      The object that was passed to the map when requesting the context menu. The context menu info object. This object may contain arbitrary data. The default implementation expects a pickInfo object which will be passed to the appropriate Layer's onCreateContextMenu method. A pickInfo object is JavaScript object with two properties: the objects that were touched (an array of Features) and the layer that object resides in.

    Returns void

setPaintRepresentationVisible

  • Sets the visibility of a specific paint representation. This allows for example to only show the BODY of a layer and not the LABEL:

      var layer = ...;
      layer.setPaintRepresentationVisible( PaintRepresentation.BODY, true );
      layer.setPaintRepresentationVisible( PaintRepresentation.LABEL, false );

    Parameters

    Returns void

setPaintRepresentationVisibleInTree

  • Sets the visibility of a specific paint representation in a layer tree. If it set to true, this will ensure that the paint representation of every parent LayerTreeNode up to the roof of the tree is configured to be visible as well.

    Parameters

    Returns void

visitChildren

  • Accepts the given visitor on the children of this.

    Parameters

    • visitor: LayerTreeVisitor

      The visitor which will receive the callbacks for the children.

    • order: VisitOrder

      The order in which the children need to be traversed.

    Returns void

whenReady

  • Wait until this layer or layer group is finished with all possible work related to any change that happened before this call.
    At that moment, the screen is up-to-date with all changes.

    Examples:

        map.mapNavigator.fit({ bounds: somewhere });
        map.layerTree.whenReady().then(makeScreenshot);

    or

        layer.painter.invalidateAll();
        layer.whenReady().then(alert);

    or

        layer.model.add(newFeature);
        layer.whenReady().then(alert);

    This call can be used to have a reliable, programmatic way to wait for all work leading up to the call to be reflected on the screen.
    The returned promise will always resolve once, when the layer is ready. The promise is rejected when the layer does not become ready in 5 minutes.

    Examples (not exhaustive) of aspects this promise will wait for:

    • While loading image data when it displayed for the first time, or after navigating the view
    • While loading image data after changing raster model properties such as WMS style
    • While loading feature data when it displayed for the first time, enters its scale range, or after navigating the view
    • While loading feature data after invalidating the layer query provider
    • While processing features after invalidating the layer feature painter or shape provider, or changing the layer filter
    • While processing features after they were added, updated or removed to/in/from a model or workingSet

    NOTE: The promise gets resolved also when an error (QueryStatus.QUERY_ERROR) occurs while handling underlying query or when the node is invisible.

    A LayerGroup or LayerTree will wait until all its children are ready.

    Returns Promise<LayerTreeNode>

    A promise that resolves to the LayerTreeNode when all current work is done

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method