<?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 Re: Retrieve Legend Info from TPK File in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/retrieve-legend-info-from-tpk-file/m-p/668229#M5947</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your question! &amp;nbsp;My guess is that all of the legend information is in the&amp;nbsp;&lt;EM&gt;tiledSublayers&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;property of &lt;EM&gt;layer&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 14px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;layer.&lt;SPAN style="color: #3495af;"&gt;tiledSublayers&lt;/SPAN&gt;.&lt;SPAN style="color: #3495af;"&gt;forEach&lt;/SPAN&gt; { (sublayer) &lt;SPAN style="color: #0433ff;"&gt;in&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 14px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sublayer.&lt;SPAN style="color: #3495af;"&gt;fetchLegendInfos&lt;/SPAN&gt;(completion: { (legendInfos, error) &lt;SPAN style="color: #0433ff;"&gt;in&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 14px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;SPAN style="color: #0433ff;"&gt;if&lt;/SPAN&gt; &lt;SPAN style="color: #0433ff;"&gt;let&lt;/SPAN&gt; error = error { &lt;SPAN style="color: #3495af;"&gt;print&lt;/SPAN&gt;(&lt;SPAN style="color: #b4261a;"&gt;"*** Error in fetchLegendInfos for &lt;/SPAN&gt;\&lt;SPAN style="color: #b4261a;"&gt;(&lt;/SPAN&gt;sublayer.&lt;SPAN style="color: #3495af;"&gt;name&lt;/SPAN&gt;&lt;SPAN style="color: #b4261a;"&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; &lt;/SPAN&gt;\&lt;SPAN style="color: #b4261a;"&gt;(&lt;/SPAN&gt;error&lt;SPAN style="color: #b4261a;"&gt;)"&lt;/SPAN&gt;); &lt;SPAN style="color: #0433ff;"&gt;return&lt;/SPAN&gt; }&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px;"&gt;&lt;/P&gt;&lt;P style="color: #008f00; background-color: #ffffff; font-size: 14px;"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;//do something with the legendInfos array...&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 14px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; })&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 14px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that each of the sublayers, which are&amp;nbsp;&lt;EM&gt;AGSArcGISTiledSublayer&lt;/EM&gt;&amp;nbsp;objects, might&amp;nbsp;also have a non-empty&amp;nbsp;&lt;EM&gt;sublayers&lt;/EM&gt;&amp;nbsp;property, so you may want to check those as well if you're still not getting the information you expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To make things easier, we do provide a Legend component and example code&amp;nbsp;in our ArcGIS Runtime Toolkit for iOS here: &amp;nbsp;&lt;A class="link-titled" href="https://github.com/Esri/arcgis-runtime-toolkit-ios" title="https://github.com/Esri/arcgis-runtime-toolkit-ios"&gt;GitHub - Esri/arcgis-runtime-toolkit-ios: Toolkit components that will simplify your iOS app development with ArcGIS Run…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you need further help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Feb 2018 22:18:16 GMT</pubDate>
    <dc:creator>MarkDostal</dc:creator>
    <dc:date>2018-02-23T22:18:16Z</dc:date>
    <item>
      <title>Retrieve Legend Info from TPK File</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/retrieve-legend-info-from-tpk-file/m-p/668228#M5946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was trying to load the data back from the tpk file.&lt;/P&gt;&lt;P&gt;This is what I what I wrote&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 12px;"&gt;&lt;SPAN style="color: #c42275;"&gt;let&lt;/SPAN&gt; layer = &lt;SPAN style="color: #3c828b;"&gt;AGSArcGISTiledLayer&lt;/SPAN&gt;.&lt;SPAN style="color: #c42275;"&gt;init&lt;/SPAN&gt;(tileCache: &lt;SPAN style="color: #3c828b;"&gt;AGSTileCache&lt;/SPAN&gt;(fileURL: &lt;SPAN style="color: #703daa;"&gt;URL&lt;/SPAN&gt;(fileURLWithPath: &lt;SPAN style="color: #539aa4;"&gt;Globals&lt;/SPAN&gt;.&lt;SPAN style="color: #539aa4;"&gt;documentsDirectory&lt;/SPAN&gt;.&lt;SPAN style="color: #703daa;"&gt;path&lt;/SPAN&gt; + &lt;SPAN style="color: #c81b13;"&gt;"/"&lt;/SPAN&gt; + file)))&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 12px;"&gt;&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 12px;"&gt;It can render the map perfectly&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 12px;"&gt;&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 12px;"&gt;However, when I try to load the legend info with the function fetchLegendInfo, the result is empty.&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 12px;"&gt;here's my code:&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 12px;"&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;layer.&lt;SPAN style="color: #294c50;"&gt;fetchLegendInfos&lt;/SPAN&gt;(completion: { (legends:[&lt;SPAN style="color: #3c828b;"&gt;AGSLegendInfo&lt;/SPAN&gt;]?, error:&lt;SPAN style="color: #703daa;"&gt;Error&lt;/SPAN&gt;?)-&amp;gt;&lt;SPAN style="color: #703daa;"&gt;Void&lt;/SPAN&gt; &lt;SPAN style="color: #c42275;"&gt;in&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;SPAN style="color: #3e1e81;"&gt;print&lt;/SPAN&gt;(&lt;SPAN style="text-decoration: underline;"&gt;legends&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; })&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the variable legends will always be "&lt;SPAN&gt;&lt;STRONG&gt;Optional([])"&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I doing it correctly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also to make sure there's actually data in the tpk file,&amp;nbsp;i open it up with hex editor, which gives me this&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="/legacyfs/online/397398_螢幕快照 2018-02-23 下午3.49.49.png" style="width: 620px; height: 53px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which shows there's data in it, but somehow it's not getting it back correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2018 20:51:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/retrieve-legend-info-from-tpk-file/m-p/668228#M5946</guid>
      <dc:creator>ArthurWu</dc:creator>
      <dc:date>2018-02-23T20:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve Legend Info from TPK File</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/retrieve-legend-info-from-tpk-file/m-p/668229#M5947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your question! &amp;nbsp;My guess is that all of the legend information is in the&amp;nbsp;&lt;EM&gt;tiledSublayers&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;property of &lt;EM&gt;layer&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 14px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;layer.&lt;SPAN style="color: #3495af;"&gt;tiledSublayers&lt;/SPAN&gt;.&lt;SPAN style="color: #3495af;"&gt;forEach&lt;/SPAN&gt; { (sublayer) &lt;SPAN style="color: #0433ff;"&gt;in&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 14px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sublayer.&lt;SPAN style="color: #3495af;"&gt;fetchLegendInfos&lt;/SPAN&gt;(completion: { (legendInfos, error) &lt;SPAN style="color: #0433ff;"&gt;in&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 14px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;SPAN style="color: #0433ff;"&gt;if&lt;/SPAN&gt; &lt;SPAN style="color: #0433ff;"&gt;let&lt;/SPAN&gt; error = error { &lt;SPAN style="color: #3495af;"&gt;print&lt;/SPAN&gt;(&lt;SPAN style="color: #b4261a;"&gt;"*** Error in fetchLegendInfos for &lt;/SPAN&gt;\&lt;SPAN style="color: #b4261a;"&gt;(&lt;/SPAN&gt;sublayer.&lt;SPAN style="color: #3495af;"&gt;name&lt;/SPAN&gt;&lt;SPAN style="color: #b4261a;"&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; &lt;/SPAN&gt;\&lt;SPAN style="color: #b4261a;"&gt;(&lt;/SPAN&gt;error&lt;SPAN style="color: #b4261a;"&gt;)"&lt;/SPAN&gt;); &lt;SPAN style="color: #0433ff;"&gt;return&lt;/SPAN&gt; }&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px;"&gt;&lt;/P&gt;&lt;P style="color: #008f00; background-color: #ffffff; font-size: 14px;"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;//do something with the legendInfos array...&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 14px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; })&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; font-size: 14px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that each of the sublayers, which are&amp;nbsp;&lt;EM&gt;AGSArcGISTiledSublayer&lt;/EM&gt;&amp;nbsp;objects, might&amp;nbsp;also have a non-empty&amp;nbsp;&lt;EM&gt;sublayers&lt;/EM&gt;&amp;nbsp;property, so you may want to check those as well if you're still not getting the information you expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To make things easier, we do provide a Legend component and example code&amp;nbsp;in our ArcGIS Runtime Toolkit for iOS here: &amp;nbsp;&lt;A class="link-titled" href="https://github.com/Esri/arcgis-runtime-toolkit-ios" title="https://github.com/Esri/arcgis-runtime-toolkit-ios"&gt;GitHub - Esri/arcgis-runtime-toolkit-ios: Toolkit components that will simplify your iOS app development with ArcGIS Run…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you need further help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2018 22:18:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/retrieve-legend-info-from-tpk-file/m-p/668229#M5947</guid>
      <dc:creator>MarkDostal</dc:creator>
      <dc:date>2018-02-23T22:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve Legend Info from TPK File</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/retrieve-legend-info-from-tpk-file/m-p/668230#M5948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for replying, however, I checked the sublayer.count, it is 0. I have also checked the toolkit, but the only thing it's showing is the layer title. Did I initialize the tiled layer from tpk file wrong?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Feb 2018 19:59:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/retrieve-legend-info-from-tpk-file/m-p/668230#M5948</guid>
      <dc:creator>ArthurWu</dc:creator>
      <dc:date>2018-02-26T19:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve Legend Info from TPK File</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/retrieve-legend-info-from-tpk-file/m-p/668231#M5949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did some more digging on my end and found out that&amp;nbsp;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;the sublayer content and legendInfo are not populated for layers created from a tile cache&lt;/SPAN&gt;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;. &amp;nbsp;This is something that is under consideration for the next release. &amp;nbsp;So you are initializing the tiled layer correctly, especially since it is drawing successfully, it's just that the legend info functionality is not yet implemented.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;Please let us know if you have more questions,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;Mark&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Feb 2018 16:27:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/retrieve-legend-info-from-tpk-file/m-p/668231#M5949</guid>
      <dc:creator>MarkDostal</dc:creator>
      <dc:date>2018-02-27T16:27:42Z</dc:date>
    </item>
  </channel>
</rss>

