Class KmlLayer
A layer that can visualize KML data.
Namespace: Esri.ArcGISRuntime.Mapping
Assembly: Esri.ArcGISRuntime.dll
Syntax
public sealed class KmlLayer : Layer, INotifyPropertyChanged, ILoadable, ILayerContent, ITimeAware
Remarks
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 document via the KmlDataset.
Functional characteristics
KML represents features as a tree of nodes, including network links, folders, and placemarks. 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 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 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 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.
Sample Code:
Constructors
Name | Description |
---|---|
KmlLayer(KmlDataset) | Initializes a new instance of the KmlLayer class with the given dataset. |
KmlLayer(Item) | Initializes a new instance of the KmlLayer class from an ArcGIS Item. |
KmlLayer(Uri) | Initializes a new instance of the KmlLayer class with a URI to a KML file. |
Properties
Name | Description |
---|---|
Dataset | Gets the KmlDataset associated with this KML layer. |
FullTimeExtent | Gets the temporal window that encapsulates the instance's complete set of data |
IsTimeFilteringEnabled | Gets or sets a value indicating whether the instance respects any temporal filters that are applied to it. |
SupportsTimeFiltering | Gets a value indicating whether the instance supports filtering its data based on time. |
TimeInterval | Gets a temporal value that represents the suggested temporal interval to use when sequentially stepping through the instance's data by time |
TimeOffset | Gets or sets the amount of time by which to offset the temporal values of data points in this instance when displaying the data in a GeoView. |
Events
Name | Description |
---|---|
FullTimeExtentChanged | Raised when the FullTimeExtent of the instance's data changes |
See Also
Applies to
Target | Versions |
---|---|
.NET Standard 2.0 | 100.4 - 200.5 |
.NET | 100.13 - 200.5 |
.NET Windows | 100.13 - 200.5 |
.NET Android | 200.0 - 200.5 |
.NET iOS | 200.0 - 200.5 |
.NET Framework | 100.4 - 200.5 |
Xamarin.Android | 100.4 - 100.15 |
Xamarin.iOS | 100.4 - 100.15 |
UWP | 100.4 - 200.5 |