<?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 How to clone a KmlLayer including loaded KmlDataSet? in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-clone-a-kmllayer-including-loaded/m-p/1306936#M11977</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've implemented myself a global/static KmlLayer cache () as loading its data from the web can take a long time.&lt;/P&gt;&lt;P&gt;When I add the instance from the cache to a MapView&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;MapView1.Map!.OperationalLayers(_staticCache.First(k =&amp;gt; k.Dataset?.Source == uri);&lt;/LI-CODE&gt;&lt;P&gt;all is fine.&lt;/P&gt;&lt;P&gt;But if I do this to a second time:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;MapView2.Map!.OperationalLayers(_staticCache.First(k =&amp;gt; k.Dataset?.Source == uri);&lt;/LI-CODE&gt;&lt;P&gt;I get an "Object already owned" exception.&lt;/P&gt;&lt;P&gt;So far so good...I thought...then I just clone the &lt;STRONG&gt;already loaded&lt;/STRONG&gt; instance of the cache before I add it to the MapViews...&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;MapView1.Map!.OperationalLayers((_staticCache.First(k =&amp;gt; k.Dataset?.Source == uri).Clone());
MapView2.Map!.OperationalLayers((_staticCache.First(k =&amp;gt; k.Dataset?.Source == uri).Clone());&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the clones status (of the Dataset) is `NotLoaded` and the data is downloaded again from the web!&lt;/P&gt;&lt;P&gt;Why is the loaded data not cloned? I haven't found any way to clone/copy or use KmlData once loaded from the web multiple times. How do I do that?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Soko&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jul 2023 14:01:56 GMT</pubDate>
    <dc:creator>SokoFromNZ</dc:creator>
    <dc:date>2023-07-10T14:01:56Z</dc:date>
    <item>
      <title>How to clone a KmlLayer including loaded KmlDataSet?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-clone-a-kmllayer-including-loaded/m-p/1306936#M11977</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've implemented myself a global/static KmlLayer cache () as loading its data from the web can take a long time.&lt;/P&gt;&lt;P&gt;When I add the instance from the cache to a MapView&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;MapView1.Map!.OperationalLayers(_staticCache.First(k =&amp;gt; k.Dataset?.Source == uri);&lt;/LI-CODE&gt;&lt;P&gt;all is fine.&lt;/P&gt;&lt;P&gt;But if I do this to a second time:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;MapView2.Map!.OperationalLayers(_staticCache.First(k =&amp;gt; k.Dataset?.Source == uri);&lt;/LI-CODE&gt;&lt;P&gt;I get an "Object already owned" exception.&lt;/P&gt;&lt;P&gt;So far so good...I thought...then I just clone the &lt;STRONG&gt;already loaded&lt;/STRONG&gt; instance of the cache before I add it to the MapViews...&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;MapView1.Map!.OperationalLayers((_staticCache.First(k =&amp;gt; k.Dataset?.Source == uri).Clone());
MapView2.Map!.OperationalLayers((_staticCache.First(k =&amp;gt; k.Dataset?.Source == uri).Clone());&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the clones status (of the Dataset) is `NotLoaded` and the data is downloaded again from the web!&lt;/P&gt;&lt;P&gt;Why is the loaded data not cloned? I haven't found any way to clone/copy or use KmlData once loaded from the web multiple times. How do I do that?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Soko&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 14:01:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-clone-a-kmllayer-including-loaded/m-p/1306936#M11977</guid>
      <dc:creator>SokoFromNZ</dc:creator>
      <dc:date>2023-07-10T14:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to clone a KmlLayer including loaded KmlDataSet?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-clone-a-kmllayer-including-loaded/m-p/1317808#M12032</link>
      <description>&lt;P&gt;Can nobody give me a hint here? Its really a bad thing to download the same data multiple times just to show them in different maps!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2023 09:50:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-clone-a-kmllayer-including-loaded/m-p/1317808#M12032</guid>
      <dc:creator>SokoFromNZ</dc:creator>
      <dc:date>2023-08-11T09:50:21Z</dc:date>
    </item>
  </channel>
</rss>

