KmlLayer

A layer that can visualize KML data. Keyhole Markup Language (KML) is a specification for working with geographic content. KML files can contain 2D and 3D content, as well as links to content from the network. You can read .kml and .kmz files from disk or the network and create, edit, and save a KML layer via the KmlDataset.

Functional characteristics

KML represents features as a tree of nodes, including network links, folders, and place marks. Like ArcGIS features, place marks are defined with point, line, or polygon geometry. KML geometry, however, is always based on the WGS84 coordinate system. KML can also have attributes, but unlike ArcGIS feature services, a KML document does not use a schema to define a standard set of fields. This API supports version 2.2 of the KML specification[https://www.ogc.org/standards/kml] as defined by the Open Geospatial Consortium (OGC).

Unique features of KML include network links and screen overlays. Network links are useful for retrieving network content on a specified interval—perfect for keeping a live map up to date. Network links can also be used to split a large KML file into multiple per-region KML files, with each being loaded only when the region is in view. Screen overlays can be used to show content, such as branding or a legend, on top of the view. Screen overlay content does not scroll with the map or react to user interaction.

All coordinates are expressed in latitude and longitude (using decimal degrees), and are based on the SpatialReference.wgs84() geographic coordinate system. Altitude is always expressed in meters. The geographic features can contain attribute information and various styles can be specified to render them. Ground overlays allow images to be displayed for specific geographic objects or draped onto the map itself. Screen overlays allow fixing images to the GeoView, and may be used for compasses, logos, legends, etc. Network links give the ability to reference remote .kml or .kmz files, and refresh them periodically.

Loading the KmlLayer also loads its underlying KmlDataset, creating one if you didn't supply one through a constructor. The structure of a KML document can be examined through KmlDataset.rootNodes after the KmlDataset has successfully loaded. Missing or inaccessible .kml and .kmz files would cause loading to fail. Missing resources referenced by the KML document (such as images or files referenced via a network link will not prevent the layer from loading.

Performance characteristics

KML files can vary significantly in the features they use, including 3D models, network links, and refresh intervals. Not all features are supported in 2D and 3D. For example, 3D models only appear when the KML layer is shown in a scene. Many KML files consist solely of a pointer to another KML file and a refresh interval. For example, the National Weather Service distributes forecast maps in the United States this way.

Since

200.1.0

See also

Constructors

Link copied to clipboard
constructor(item: Item)

Creates a new KML layer object from a portal item.

constructor(kmlDataset: KmlDataset)

Creates a KML layer. KML layers are read-only and do not allow authoring or editing.

Properties

Link copied to clipboard

The KML dataset providing the content for the layer. The KML dataset associated with this KML layer. The KML dataset is the authoritative source for the layer's KML data. The KML dataset should be used when access to the tree of KML nodes is needed (for example to build a legend or toggle node visibility).

Inherited properties

Link copied to clipboard

The attribution text for the layer.

Link copied to clipboard
open override val canChangeVisibility: Boolean

A flag indicating whether the layer content's visibility can be changed. A flag indicating whether the layer content visibility can be changed. Will return false if an error occurs.

Link copied to clipboard

The description for the layer.

Link copied to clipboard

The full extent of this layer, which is the extent where all layer data is contained. You can use this to zoom to all of the data contained in this layer. For feature layers, the extent is retrieved from its FeatureTable.extent.

Link copied to clipboard
open override val fullTimeExtent: StateFlow<TimeExtent?>

The full time extent of the layer. If the layer, such as an ArcGISMapImageLayer, has sublayers with different time extents, fullTimeExtent is a union of its sublayer's time extents.

Link copied to clipboard
var id: String

The unique identifying string for the layer, as specified in a map or scene. The id is used by other parts of this API to refer to a specific Layer, such as in a set of FeatureFenceParameters or a FacilityLayerDefinition. If not supplied, all layers will be assigned a unique id when created.

Link copied to clipboard

True if the layer supports identify, false otherwise. The value of this property may not be correct until the layer is in a fully loaded state.

Link copied to clipboard
open override var isTimeFilteringEnabled: Boolean

True if the layer filters data based on its GeoView.timeExtent, false otherwise. This is only applicable if the layer's TimeAware.supportsTimeFiltering value is true. If the GeoView.timeExtent value is null, no time filtering is applied and all content is rendered.

Link copied to clipboard
open override var isVisible: Boolean

The layer content's visibility. The layer content visibility. Will return false if an error occurs.

Link copied to clipboard
val item: Item?

The item the layer has been created from.

Link copied to clipboard
open override val loadStatus: StateFlow<LoadStatus>

The load status.

Link copied to clipboard

The maximum scale for the layer. The maximum scale at which this layer is visible. If the map or scene is zoomed in beyond this scale, the layer will not be visible. A value of 0 means there is no maximum scale threshold and the layer will be visible at the smallest scale available for the map or scene. If the value is nil, there is no maximum scale. All of the connected map and scene views will be updated.

Link copied to clipboard

The minimum scale for the layer. The minimum scale at which this layer is visible. If the map or scene is zoomed out beyond this scale, the layer will not be visible. A value of 0 means there is no minimum scale threshold and the layer will be visible at the largest scale available for the map or scene. If the value is nil, there is no minimum scale. All of the connected map and scene views will be updated.

Link copied to clipboard
open override var name: String

The name of this layer.

Link copied to clipboard

The opacity for the layer. The opacity of this layer as a value between 0 (fully transparent) and 1 (fully opaque). The default opacity value is 1.

Link copied to clipboard
open override var showInLegend: Boolean

A flag indicating whether the layer content participates in the legend. A flag indicating whether the layer content is shown in the legend.

Link copied to clipboard

The spatial reference of the layer.

Link copied to clipboard
open override val subLayerContents: StateFlow<List<LayerContent>>

The sub layer contents of a layer content.

Link copied to clipboard
open override val supportsTimeFiltering: Boolean

True if the layer supports filtering data based on its time values, false otherwise.

Link copied to clipboard
open override val timeInterval: TimeValue?

The suggested time slider step size for this time aware layer. You can use this information to set the step size for a time slider control. The value is null if no time interval is suggested. The author of the layer's data typically configures this property if the data has been collected on a regular basis. For example, the daily position of a hurricane.

Link copied to clipboard
open override var timeOffset: TimeValue?

The amount of time by which the temporal values of this layer's data points are offset when displaying it in a GeoView. The time offset is subtracted from the time extent set on the layer's GeoView. This is useful if you want to overlay data in multiple layers that lies within different temporal extents. For example, if you want to compare data in one layer for a certain year with data in the same layer from the subsequent year, you can create two layers that reference the same data's service endpoint but set the TimeValue in one of the layers to be one year.

Link copied to clipboard
val visibilityChanged: SharedFlow<Boolean>

Callback invoked when the visibility of the layer changes.

Functions

Link copied to clipboard
open override fun clone(): KmlLayer

Clones the KmlLayer.

Inherited functions

Link copied to clipboard
open override fun cancelLoad()

Cancels loading metadata for the Loadable object.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open suspend override fun fetchLegendInfos(): Result<List<LegendInfo>>

Fetches the list of legend info.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun isVisibleAtScale(scale: Double): Boolean

Returns the layer content's effective visibility at the specified scale. Returns the effective layer content visibility. This effective visibility takes care of the effective visibility of the parents at the specified scale. Will return false if an error occurs.

Link copied to clipboard
open suspend override fun load(): Result<Unit>

Loads the metadata for the object.

Link copied to clipboard
open suspend override fun retryLoad(): Result<Unit>

Loads or retries loading metadata for the object.