<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Showing Layer on SceneView works in Windows XAML but not iOS in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/showing-layer-on-sceneview-works-in-windows-xaml/m-p/272746#M3204</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My goal is to load a KML file to display a layer on a SceneView using C# and Arcgis in both Windows and iOS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following code works in Windows XAML but it does not work on iOS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Create a new basemap.&lt;BR /&gt;Basemap imageryBasemap = Basemap.CreateImageryWithLabels();&lt;/P&gt;&lt;P&gt;// Create and show a new scene with imagery basemap.&lt;BR /&gt;MySceneView.Scene = new Scene(imageryBasemap);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;KmlLayer layer;&lt;/P&gt;&lt;P&gt;layer = new KmlLayer(new Uri(name)); //name is a local filename&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Add the selected layer to the map.&lt;BR /&gt; MySceneView.Scene.OperationalLayers.Add(layer);&lt;BR /&gt; await layer.LoadAsync();&lt;/P&gt;&lt;P&gt;await MySceneView.SetViewpointAsync(new Viewpoint(layer.FullExtent));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This displays a KML layer at a specific location and zooms into it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using iOS, the file has been included in the application package in a kml directory bundled with the application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Create a new basemap.&lt;BR /&gt; Basemap imageryBasemap = Basemap.CreateImageryWithLabels();&lt;/P&gt;&lt;P&gt;// Create and show a new scene with imagery basemap.&lt;BR /&gt; MySceneView.Scene = new Scene(imageryBasemap);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;KmlLayer layer;&lt;BR /&gt; try&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;var uriname = new Uri("file:///./kml/mylayer.kml");&lt;BR /&gt;&amp;nbsp; &amp;nbsp;layer = new KmlLayer(uriname);&lt;BR /&gt; }&lt;BR /&gt; catch (Exception e)&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Console.WriteLine("ERROR OPENING KML FILE: {0}", e.Message);&amp;nbsp; // No error here.&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Console.WriteLine("KML FILE named {0} loaded...", layer.Name); // layer has no Name here which indicates to me that although the above didn't throw an exception the layer wasn't actually loaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Add the selected layer to the map.&lt;BR /&gt; MySceneView.Scene.OperationalLayers.Add(layer);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Zoomed into the approximate area but there is no layer shown on the map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Envelope myEnvelope = new Envelope(-118.45, 45.92, -118.42, 45.95, SpatialReferences.Wgs84);&lt;BR /&gt; MySceneView.SetViewpointAsync(new Viewpoint(myEnvelope));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, any help to load a &lt;SPAN&gt;KmlLayer&amp;nbsp;&lt;/SPAN&gt;from a local data element or stream rather than from a URI would be great.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Dec 2019 01:57:36 GMT</pubDate>
    <dc:creator>KeithMcCall</dc:creator>
    <dc:date>2019-12-11T01:57:36Z</dc:date>
    <item>
      <title>Showing Layer on SceneView works in Windows XAML but not iOS</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/showing-layer-on-sceneview-works-in-windows-xaml/m-p/272746#M3204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My goal is to load a KML file to display a layer on a SceneView using C# and Arcgis in both Windows and iOS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following code works in Windows XAML but it does not work on iOS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Create a new basemap.&lt;BR /&gt;Basemap imageryBasemap = Basemap.CreateImageryWithLabels();&lt;/P&gt;&lt;P&gt;// Create and show a new scene with imagery basemap.&lt;BR /&gt;MySceneView.Scene = new Scene(imageryBasemap);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;KmlLayer layer;&lt;/P&gt;&lt;P&gt;layer = new KmlLayer(new Uri(name)); //name is a local filename&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Add the selected layer to the map.&lt;BR /&gt; MySceneView.Scene.OperationalLayers.Add(layer);&lt;BR /&gt; await layer.LoadAsync();&lt;/P&gt;&lt;P&gt;await MySceneView.SetViewpointAsync(new Viewpoint(layer.FullExtent));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This displays a KML layer at a specific location and zooms into it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using iOS, the file has been included in the application package in a kml directory bundled with the application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Create a new basemap.&lt;BR /&gt; Basemap imageryBasemap = Basemap.CreateImageryWithLabels();&lt;/P&gt;&lt;P&gt;// Create and show a new scene with imagery basemap.&lt;BR /&gt; MySceneView.Scene = new Scene(imageryBasemap);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;KmlLayer layer;&lt;BR /&gt; try&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;var uriname = new Uri("file:///./kml/mylayer.kml");&lt;BR /&gt;&amp;nbsp; &amp;nbsp;layer = new KmlLayer(uriname);&lt;BR /&gt; }&lt;BR /&gt; catch (Exception e)&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Console.WriteLine("ERROR OPENING KML FILE: {0}", e.Message);&amp;nbsp; // No error here.&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Console.WriteLine("KML FILE named {0} loaded...", layer.Name); // layer has no Name here which indicates to me that although the above didn't throw an exception the layer wasn't actually loaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Add the selected layer to the map.&lt;BR /&gt; MySceneView.Scene.OperationalLayers.Add(layer);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Zoomed into the approximate area but there is no layer shown on the map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Envelope myEnvelope = new Envelope(-118.45, 45.92, -118.42, 45.95, SpatialReferences.Wgs84);&lt;BR /&gt; MySceneView.SetViewpointAsync(new Viewpoint(myEnvelope));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, any help to load a &lt;SPAN&gt;KmlLayer&amp;nbsp;&lt;/SPAN&gt;from a local data element or stream rather than from a URI would be great.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2019 01:57:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/showing-layer-on-sceneview-works-in-windows-xaml/m-p/272746#M3204</guid>
      <dc:creator>KeithMcCall</dc:creator>
      <dc:date>2019-12-11T01:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: Showing Layer on SceneView works in Windows XAML but not iOS</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/showing-layer-on-sceneview-works-in-windows-xaml/m-p/272747#M3205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You wouldn't see an error until you try and load the KML Dataset. Ie&lt;BR /&gt;await kmlLayer.Dataset.LoadAsync();&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2019 18:14:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/showing-layer-on-sceneview-works-in-windows-xaml/m-p/272747#M3205</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2019-12-12T18:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Showing Layer on SceneView works in Windows XAML but not iOS</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/showing-layer-on-sceneview-works-in-windows-xaml/m-p/272748#M3206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks that was a good suggestion.&amp;nbsp; I tried that but still have the same problem on IOS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The call fails at&amp;nbsp;&lt;STRONG&gt;layer = new KmlLayer(uriname);&amp;nbsp; I have tried all variants of the file name I can think of, including getting IOS to resolve the path from the file attributes.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The KML layer file is not found by the call to load it.&amp;nbsp; Here is the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Console.WriteLine("------------------------ &lt;SPAN&gt;Can I read the file attributes to find the file name I should be loading???&lt;/SPAN&gt; ---------------------------");&lt;BR /&gt; listallfiles();&lt;BR /&gt; Console.WriteLine("------------------------ Confirmed ---------------------------------------------");&lt;/P&gt;&lt;P&gt;var text = File.ReadAllText("kml/SevenHills.kml");&lt;BR /&gt; Console.WriteLine("------------------------ Can I read the file data??? ---------------------------");&lt;BR /&gt; Console.WriteLine(text);&lt;BR /&gt; Console.WriteLine("------------------------ Confirmed ---------------------------------------------");&lt;/P&gt;&lt;P&gt;string apppath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)+"PrecisionView.app/";&lt;/P&gt;&lt;P&gt;KmlLayer layer;&lt;BR /&gt; try&lt;BR /&gt; {&lt;BR /&gt; ///private/var/containers/Bundle/Application/0DE39905-B65F-4D3B-89E8-03733F22CD97/PrecisionView.app/kml&lt;BR /&gt; //BAD: file:///var/mobile/Containers/Data/Application/0EA9D36C-0FCF-470F-8330-A05AB0EB8078/DocumentsPrecisionView.app//PrecisionView.app/kml/SevenHills.kml&lt;BR /&gt; //string uripath = String.Format("file://{0}/{1}", apppath, "PrecisionView.app/kml/SevenHills.kml");&lt;BR /&gt; string uripath = String.Format("/private/var/containers/Bundle/Application/2B4FAC7A-2D95-4930-B8B3-EDB74E5EE5C1/PrecisionView.app/kml/SevenHills.kml");&lt;/P&gt;&lt;P&gt;Console.WriteLine("------------------------ Can I load the layer??? ---------------------------");&lt;/P&gt;&lt;P&gt;Console.WriteLine("Opening layer at {0}", uripath);&lt;/P&gt;&lt;P&gt;var uriname = new Uri(uripath);&lt;BR /&gt; Console.WriteLine("Got uriname *{0}*", uriname);&lt;BR /&gt; &lt;STRONG&gt;layer = new KmlLayer(uriname);&lt;/STRONG&gt;&lt;BR /&gt; await layer.Dataset.LoadAsync();&lt;/P&gt;&lt;P&gt;// Add the selected layer to the map.&lt;BR /&gt; MySceneView.Scene.OperationalLayers.Add(layer);&lt;BR /&gt; }&lt;BR /&gt; catch (Exception e)&lt;BR /&gt; {&lt;BR /&gt; Console.WriteLine("&lt;STRONG&gt;ERROR OPENING KML LAYER: {0}&lt;/STRONG&gt;", e.Message);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code output...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;------------------------ &lt;STRONG&gt;Can I read the file attributes to find the file name I should be loading???&lt;/STRONG&gt; ---------------------------&lt;BR /&gt;File entry /private/var/containers/Bundle/Application/575AAF82-F750-4EC5-B447-519B475B5162/PrecisionView.app/kml/SevenHills.kml was created on Tuesday, December 10, 2019&lt;BR /&gt;&amp;nbsp;------------------------ &lt;STRONG&gt;Confirmed&lt;/STRONG&gt; ---------------------------------------------&lt;BR /&gt;------------------------ &lt;STRONG&gt;Can I read the file data???&lt;/STRONG&gt; ---------------------------&lt;BR /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;BR /&gt;&amp;lt;kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"&amp;gt;&lt;BR /&gt;&amp;lt;Document&amp;gt;&lt;BR /&gt; &amp;lt;name&amp;gt;SevenHills.kml&amp;lt;/name&amp;gt;&lt;BR /&gt; &amp;lt;Style id="s_ylw-pushpin"&amp;gt;&lt;BR /&gt; &amp;lt;IconStyle&amp;gt;&lt;BR /&gt; &amp;lt;scale&amp;gt;1.1&amp;lt;/scale&amp;gt;&lt;BR /&gt; &amp;lt;Icon&amp;gt;&lt;BR /&gt; &amp;lt;href&amp;gt;http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png&amp;lt;/href&amp;gt;&lt;BR /&gt; &amp;lt;/Icon&amp;gt;&lt;BR /&gt; &amp;lt;hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/&amp;gt;&lt;BR /&gt; &amp;lt;/IconStyle&amp;gt;&lt;BR /&gt; &amp;lt;/Style&amp;gt;&lt;BR /&gt; &amp;lt;StyleMap id="m_ylw-pushpin"&amp;gt;&lt;BR /&gt; &amp;lt;Pair&amp;gt;&lt;BR /&gt; &amp;lt;key&amp;gt;normal&amp;lt;/key&amp;gt;&lt;BR /&gt; &amp;lt;styleUrl&amp;gt;#s_ylw-pushpin&amp;lt;/styleUrl&amp;gt;&lt;BR /&gt; &amp;lt;/Pair&amp;gt;&lt;BR /&gt; &amp;lt;Pair&amp;gt;&lt;BR /&gt; &amp;lt;key&amp;gt;highlight&amp;lt;/key&amp;gt;&lt;BR /&gt; &amp;lt;styleUrl&amp;gt;#s_ylw-pushpin_hl&amp;lt;/styleUrl&amp;gt;&lt;BR /&gt; &amp;lt;/Pair&amp;gt;&lt;BR /&gt; &amp;lt;/StyleMap&amp;gt;&lt;BR /&gt; &amp;lt;Style id="s_ylw-pushpin_hl"&amp;gt;&lt;BR /&gt; &amp;lt;IconStyle&amp;gt;&lt;BR /&gt; &amp;lt;scale&amp;gt;1.3&amp;lt;/scale&amp;gt;&lt;BR /&gt; &amp;lt;Icon&amp;gt;&lt;BR /&gt; &amp;lt;href&amp;gt;http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png&amp;lt;/href&amp;gt;&lt;BR /&gt; &amp;lt;/Icon&amp;gt;&lt;BR /&gt; &amp;lt;hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/&amp;gt;&lt;BR /&gt; &amp;lt;/IconStyle&amp;gt;&lt;BR /&gt; &amp;lt;/Style&amp;gt;&lt;BR /&gt; &amp;lt;Placemark&amp;gt;&lt;BR /&gt; &lt;BR /&gt;&amp;lt;name&amp;gt;SevenHills&amp;lt;/name&amp;gt;&lt;BR /&gt; &amp;lt;styleUrl&amp;gt;#m_ylw-pushpin&amp;lt;/styleUrl&amp;gt;&lt;BR /&gt; &amp;lt;LineString&amp;gt;&lt;BR /&gt; &amp;lt;tessellate&amp;gt;1&amp;lt;/tessellate&amp;gt;&lt;BR /&gt; &amp;lt;coordinates&amp;gt;&lt;BR /&gt; -118.4446238031191,45.94000421858365,0 -118.4450094178675,45.93994794787083,0 -118.4498222134527,45.93992062957039,0 -118.4500906993986,45.93985975936327,0 -118.4505174909842,45.93983704458147,0 -118.4506740720017,45.93984775259004,0 -118.4525384944131,45.94040390603141,0 -118.4529241486569,45.94065919135618,0 -118.453620877357,45.94091070219196,0 -118.4547612503623,45.94172367299246,0 -118.4550541786503,45.94188449253917,0 -118.455239083684,45.94199524572046,0 -118.4555545265985,45.94236607539884,0 -118.4559509010189,45.94274036876337,0 -118.4560208178186,45.94329440929713,0 -118.4560468388909,45.94360971654032,0 -118.4561156245048,45.94385465236871,0 -118.4560522801767,45.94408463509967,0 -118.4551206805496,45.94530381009788,0 -118.4533325449118,45.94740862523928,0 -118.4518443683923,45.94898830919681,0 -118.4514731586695,45.94944601639191,0 -118.451028383202,45.94974797366869,0 -1&lt;BR /&gt;18.4493239543043,45.95048011909979,0 -118.4477220268395,45.95113079524753,0 -118.447339088874,45.95108785542429,0 -118.4468485708434,45.95039280290377,0 -118.4466113293553,45.95011731022146,0 -118.446356216983,45.94994690914195,0 -118.4461523221155,45.94982942741466,0 -118.4460285096415,45.94968884730044,0 -118.4460329814595,45.94956775407266,0 -118.4461439704801,45.94927619962923,0 -118.4460596672124,45.94916727943071,0 -118.4458574282867,45.94914489020882,0 -118.4455750473521,45.94914791492524,0 -118.4453368324822,45.94898700191206,0 -118.4449551293189,45.94896331920968,0 -118.4444213851763,45.94890554776818,0 -118.4439528720892,45.94885975957928,0 -118.4434563634693,45.94887390132582,0 -118.4430032656326,45.94888625665448,0 -118.442772548067,45.94888083432534,0 -118.4426436296657,45.94876062941377,0 -118.4426003787763,45.94855011202757,0 -118.4424216099796,45.94834787625387,0 -118.4420682021547,45.94809749861648,0 -118.4418570593747,45.94794806768007,0 -118.4416575461201,45.94781784342278,0 -118.4415081315&lt;BR /&gt;729,45.94770373683252,0 -118.4415404378177,45.94735740639674,0 -118.4446230976549,45.94733122500705,0 -118.4445857085007,45.94605786991772,0 -118.4446238031191,45.94000421858365,0 &lt;BR /&gt; &amp;lt;/coordinates&amp;gt;&lt;BR /&gt; &amp;lt;/LineString&amp;gt;&lt;BR /&gt; &amp;lt;/Placemark&amp;gt;&lt;BR /&gt;&amp;lt;/Document&amp;gt;&lt;BR /&gt;&amp;lt;/kml&amp;gt;&lt;BR /&gt;&amp;nbsp;------------------------ &lt;STRONG&gt;Confirmed&lt;/STRONG&gt; ---------------------------------------------&lt;BR /&gt;------------------------ &lt;STRONG&gt;Can I load the layer???&lt;/STRONG&gt; ---------------------------&lt;BR /&gt;Opening layer at /private/var/containers/Bundle/Application/2B4FAC7A-2D95-4930-B8B3-EDB74E5EE5C1/PrecisionView.app/kml/SevenHills.kml&lt;BR /&gt;Got uriname *file:///private/var/containers/Bundle/Application/2B4FAC7A-2D95-4930-B8B3-EDB74E5EE5C1/PrecisionView.app/kml/SevenHills.kml*&lt;BR /&gt;&lt;STRONG&gt;ERROR OPENING KML LAYER: File not found&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Dec 2019 02:13:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/showing-layer-on-sceneview-works-in-windows-xaml/m-p/272748#M3206</guid>
      <dc:creator>KeithMcCall</dc:creator>
      <dc:date>2019-12-14T02:13:22Z</dc:date>
    </item>
  </channel>
</rss>

