KML file issues with Runtime for .NET app version 10.2.6: 3D scene view does not work 2D view works fine

3776
0
11-12-2015 08:55 AM
NikhilSharma
New Contributor II

Hi All,

I have  simple runtime for .net application using a scene view. I try to load a kml file in that scene view and it does not work but as soon as I change the scene view to map view i.e. 2D it works fine. KML file supports 3D i.e. scene view as written in the documentation provided by ESRI for runtime sdk for .net 10.2.6. The KML file is present in my machine and the app uses the drag and drop event to locate the KML file.

Here is the link:

https://developers.arcgis.com/net/desktop/guide/add-layers-to-your-scene.htm

Here is the sample code:

private async void MyMapView_Drop(object sender, DragEventArgs e)

        {

            if (e.Data.GetDataPresent(DataFormats.FileDrop))

            {

                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

                KmlLayer kmlLayer = new KmlLayer(new Uri(files[0]));

                await kmlLayer.InitializeAsync();

                //Add the kml layer

                //MyMapView.Map.Layers.Add(kmlLayer);

                MyMapView.Scene.Layers.Add(kmlLayer);

                //Zoom to the kml layer if available

                if (kmlLayer.RootFeature.Viewpoint != null)

                    await MyMapView.SetViewAsync(kmlLayer.RootFeature.Viewpoint);

                await MyMapView.LayersLoadedAsync();

            }

        }

        private void ResetMapButton_Click(object sender, RoutedEventArgs e)

        {

           // MyMapView.Map.Layers.Clear();

            //MyMapView.Map.Layers.Add(new ArcGISTiledMapServiceLayer(new Uri("http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer")));

            MyMapView.Scene.Layers.Clear();

            MyMapView.Scene.Layers.Add(new ArcGISTiledMapServiceLayer(new Uri("http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer")));

        }

I am attaching the app and the kml file.

Kindly suggest.

Regards

NIKHIL

0 Kudos
0 Replies