Click or drag to resize

KmlGroundOverlay Class

A KML GroundOverlay object.
Inheritance Hierarchy

Namespace:  Esri.ArcGISRuntime.Ogc
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.7.0.0
Syntax
C#
public sealed class KmlGroundOverlay : KmlNode

The KmlGroundOverlay type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleKmlGroundOverlay
Initializes a new instance of the KmlGroundOverlay class.
Top
Properties
  NameDescription
Public propertyAddress
Gets or sets an address associated with this node.
(Inherited from KmlNode.)
Public propertyAltitude
Gets or sets the altitude of this ground overlay, in meters.
Public propertyAltitudeMode
Gets or sets the altitude mode of the KML ground overlay. Ground overlays support Absolute and ClampToGround.
Public propertyBalloonBackgroundColor
Gets the color that should be used for the background of the node's popup balloon.
(Inherited from KmlNode.)
Public propertyCode exampleBalloonContent
Gets the balloon popup content for this KML node as a string containing HTML.
(Inherited from KmlNode.)
Public propertyCode exampleColor
Gets or sets the color mask applied to the KML ground overlay's image.
Public propertyDescription
Gets or sets the description of this KML node.
(Inherited from KmlNode.)
Public propertyDrawOrder
Gets or sets the draw order of this ground overlay. Overlays with higher DrawOrder values are drawn on top of those with lower values.
Public propertyCode exampleExtent
Gets the bounding extent of this KML node.
(Inherited from KmlNode.)
Public propertyCode exampleGeometry
Gets or sets the geometry for this ground overlay.
Public propertyHighlightStyle
Gets or sets the style used to render this KML node when IsHighlighted is true.
(Inherited from KmlNode.)
Public propertyIcon
Gets or sets the KML ground overlay icon.
Public propertyId
Gets or sets the ID of the KML node.
(Inherited from KmlNode.)
Public propertyIsHighlighted
Gets or sets a value indicating whether this KML node is highlighted. This controls whether the default Style or an alternate HighlightStyle (if present) is used for rendering the node.
(Inherited from KmlNode.)
Public propertyCode exampleIsVisible
Gets or sets a value indicating whether this KML node is visible.
(Inherited from KmlNode.)
Public propertyCode exampleName
Gets or sets the name of this KML node.
(Inherited from KmlNode.)
Public propertyParent
Gets the parent of this node.
(Inherited from KmlNode.)
Public propertyRefreshError
Gets the reason for refresh failure if the RefreshStatus is Failed.
(Inherited from KmlNode.)
Public propertyRefreshStatus
Gets the KML node's refresh status.
(Inherited from KmlNode.)
Public propertyCode exampleRotation
Gets or sets the rotation of this overlay, in degrees.
Public propertySnippet
Gets or sets the optional snippet for this KML node.
(Inherited from KmlNode.)
Public propertySnippetMaxLines
Gets or sets the maximum number of lines of snippet to be shown in the UI.
(Inherited from KmlNode.)
Public propertyCode exampleStyle
Gets or sets the style used to render this KML node.
(Inherited from KmlNode.)
Public propertyUxIcon
Gets the icon associated with this KML node for use in the user interface.
(Inherited from KmlNode.)
Public propertyUxIconColor
Gets the color used to tint the UX icon.
(Inherited from KmlNode.)
Public propertyUxIconId
Gets the UX icon id.
(Inherited from KmlNode.)
Public propertyCode exampleViewpoint
Gets the KmlViewpoint associated with this KML node or null if no Camera or LookAt is specified for the node.
(Inherited from KmlNode.)
Top
Methods
  NameDescription
Public methodSaveAsAsync
Saves this node and any referenced local files as a KMZ archive.
(Inherited from KmlNode.)
Public methodCode exampleWriteToAsync
Saves this node and any referenced local files into the given Stream as a KMZ archive.
(Inherited from KmlNode.)
Top
Events
  NameDescription
Public eventCode examplePropertyChanged
Occurs when a property value changes.
(Inherited from KmlNode.)
Top
Remarks
KML GroundOverlay is an image draped onto the terrain.
Examples

Android

Example Name: EditKmlGroundOverlay

Edit the values of a KML ground overlay.

Code example screen shot.

C#
// Copyright 2019 Esri.
// 
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
// language governing permissions and limitations under the License.

using Android.App;
using Android.OS;
using Android.Widget;
using ArcGISRuntime;
using ArcGISRuntime.Samples.Managers;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Ogc;
using Esri.ArcGISRuntime.UI.Controls;
using System;

namespace ArcGISRuntimeXamarin.Samples.EditKmlGroundOverlay
{
    [Activity(ConfigurationChanges = Android.Content.PM.ConfigChanges.Orientation | Android.Content.PM.ConfigChanges.ScreenSize)]
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "Edit KML ground overlay",
        "Layers",
        "Edit the values of a KML ground overlay.",
        "")]
    [ArcGISRuntime.Samples.Shared.Attributes.OfflineData("1f3677c24b2c446e96eaf1099292e83e")]
    public class EditKmlGroundOverlay : Activity
    {
        // Hold references to the UI controls.
        private SceneView _mySceneView;
        private SeekBar _slider;
        private TextView _valueLabel;

        // Uri of the image for the ground overlay.
        private readonly Uri _imageryUri = new Uri(DataManager.GetDataFolder("1f3677c24b2c446e96eaf1099292e83e", "1944.jpg"));

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Title = "Edit KML ground overlay";

            CreateLayout();
            Initialize();
        }

        private void Initialize()
        {
            // Create a scene for the sceneview.
            Scene myScene = new Scene(Basemap.CreateImagery());
            _mySceneView.Scene = myScene;

            // Create a geometry for the ground overlay.
            Envelope overlayGeometry = new Envelope(-123.066227926904, 44.04736963555683, -123.0796942287304, 44.03878298600624, SpatialReferences.Wgs84);

            // Create a KML Icon for the overlay image.
            KmlIcon overlayImage = new KmlIcon(_imageryUri);

            // Create the KML ground overlay.
            KmlGroundOverlay overlay = new KmlGroundOverlay(overlayGeometry, overlayImage);

            // Set the rotation of the ground overlay.
            overlay.Rotation = -3.046024799346924;

            // Create a KML dataset with the ground overlay as the root node.
            KmlDataset dataset = new KmlDataset(overlay);

            // Create a KML layer for the scene view.
            KmlLayer layer = new KmlLayer(dataset);

            // Add the layer to the map.
            _mySceneView.Scene.OperationalLayers.Add(layer);

            // Move the viewpoint to the ground overlay.
            _mySceneView.SetViewpoint(new Viewpoint(overlay.Geometry, new Camera(overlay.Geometry.Extent.GetCenter(), 1250, 45, 60, 0)));

            // Add an event handler for the on-screen slider.
            _slider.ProgressChanged += (s, e) =>
            {
                // Change the color of the KML ground overlay image to edit the alpha-value. (Other color values are left as-is in the original image.)
                overlay.Color = System.Drawing.Color.FromArgb(e.Progress, 0, 0, 0);

                // Display the value.
                _valueLabel.Text = e.Progress.ToString();
            };
        }

        private void CreateLayout()
        {
            // Load the layout for the sample from the .axml file.
            SetContentView(Resource.Layout.EditKmlGroundOverlay);

            // Update control references to point to the controls defined in the layout.
            _mySceneView = FindViewById<SceneView>(Resource.Id.SceneView);
            _slider = FindViewById<SeekBar>(Resource.Id.Slider);
            _valueLabel = FindViewById<TextView>(Resource.Id.ValueLabel);
        }
    }
}
Examples

Xamarin Forms Android

Example Name: EditKmlGroundOverlay

Edit the values of a KML ground overlay.

Code example screen shot.

C#
// Copyright 2019 Esri.
// 
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
// language governing permissions and limitations under the License.

using ArcGISRuntime.Samples.Managers;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Ogc;
using System;
using Xamarin.Forms;

namespace ArcGISRuntimeXamarin.Samples.EditKmlGroundOverlay
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "Edit KML ground overlay",
        "Layers",
        "Edit the values of a KML ground overlay.",
        "")]
    [ArcGISRuntime.Samples.Shared.Attributes.OfflineData("1f3677c24b2c446e96eaf1099292e83e")]
    public partial class EditKmlGroundOverlay : ContentPage
    {
        private readonly Uri _imageryUri = new Uri(DataManager.GetDataFolder("1f3677c24b2c446e96eaf1099292e83e", "1944.jpg"));

        public EditKmlGroundOverlay()
        {
            InitializeComponent();
            Initialize();
        }

        private void Initialize()
        {
            // Create a scene for the sceneview.
            Scene myScene = new Scene(Basemap.CreateImagery());
            MySceneView.Scene = myScene;

            // Create a geometry for the ground overlay.
            Envelope overlayGeometry = new Envelope(-123.066227926904, 44.04736963555683, -123.0796942287304, 44.03878298600624, SpatialReferences.Wgs84);

            // Create a KML Icon for the overlay image.
            KmlIcon overlayImage = new KmlIcon(_imageryUri);

            // Create the KML ground overlay.
            KmlGroundOverlay overlay = new KmlGroundOverlay(overlayGeometry, overlayImage);

            // Set the rotation of the ground overlay.
            overlay.Rotation = -3.046024799346924;

            // Create a KML dataset with the ground overlay as the root node.
            KmlDataset dataset = new KmlDataset(overlay);

            // Create a KML layer for the scene view.
            KmlLayer layer = new KmlLayer(dataset);

            // Add the layer to the map.
            MySceneView.Scene.OperationalLayers.Add(layer);

            // Move the viewpoint to the ground overlay.
            MySceneView.SetViewpoint(new Viewpoint(overlay.Geometry, new Camera(overlay.Geometry.Extent.GetCenter(), 1250, 45, 60, 0)));

            // Add an event handler for the on-screen slider.
            OpacitySlider.ValueChanged += (s, e) =>
            {
                // Change the color of the KML ground overlay image to edit the alpha-value. (Other color values are left as-is in the original image.)
                overlay.Color = System.Drawing.Color.FromArgb((int)(e.NewValue), 0, 0, 0);

                // Display the value.
                ValueLabel.Text = ((int)OpacitySlider.Value).ToString();
            };
        }
    }
}
XAML
<ContentPage
    x:Class="ArcGISRuntimeXamarin.Samples.EditKmlGroundOverlay.EditKmlGroundOverlay"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <esriUI:SceneView x:Name="MySceneView" Grid.Row="0" />
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="auto" />
            </Grid.ColumnDefinitions>
            <Label
                Grid.Column="0"
                Margin="5"
                HorizontalTextAlignment="Center"
                Text="Opacity"
                VerticalTextAlignment="Center" />
            <Slider
                x:Name="OpacitySlider"
                Grid.Column="1"
                Margin="5"
                Maximum="255"
                Minimum="0"
                Value="255" />
            <Label
                x:Name="ValueLabel"
                Grid.Column="2"
                Margin="5"
                HorizontalTextAlignment="Center"
                Text="255"
                VerticalTextAlignment="Center" />
        </Grid>
    </Grid>
</ContentPage>
See Also
Additional Examples
Hyperlink to ExampleDescription
EditKmlGroundOverlayEdit the values of a KML ground overlay.