<?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 access to layer description/properties with ArcGIS Pro SDK w/o instantiation the layer in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-description-properties-with/m-p/1218983#M8831</link>
    <description>&lt;P&gt;I would like to get layers' description/properties without adding/creating the layer. Is it possible to get the all the info directly from the layer file (.lyr or .lyrx) in ArcGIS Pro SDK. It is fairly simple in ArcPy but I don't wanna switch between ArcPy and the SDK.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I open a layer file I get something like this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Amadeus111_0-1664982740884.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/52899iE3E26CD7CF154687/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Amadeus111_0-1664982740884.png" alt="Amadeus111_0-1664982740884.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Oct 2022 15:13:12 GMT</pubDate>
    <dc:creator>Amadeus111</dc:creator>
    <dc:date>2022-10-05T15:13:12Z</dc:date>
    <item>
      <title>How to access to layer description/properties with ArcGIS Pro SDK w/o instantiation the layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-description-properties-with/m-p/1218983#M8831</link>
      <description>&lt;P&gt;I would like to get layers' description/properties without adding/creating the layer. Is it possible to get the all the info directly from the layer file (.lyr or .lyrx) in ArcGIS Pro SDK. It is fairly simple in ArcPy but I don't wanna switch between ArcPy and the SDK.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I open a layer file I get something like this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Amadeus111_0-1664982740884.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/52899iE3E26CD7CF154687/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Amadeus111_0-1664982740884.png" alt="Amadeus111_0-1664982740884.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 15:13:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-description-properties-with/m-p/1218983#M8831</guid>
      <dc:creator>Amadeus111</dc:creator>
      <dc:date>2022-10-05T15:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to access to layer description/properties with ArcGIS Pro SDK w/o instantiation the layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-description-properties-with/m-p/1219048#M8832</link>
      <description>&lt;P&gt;You want to use the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic26514.html" target="_self"&gt;LayerDocument&lt;/A&gt; class.&lt;/P&gt;&lt;P&gt;Your workflow will be similar to that shown here in this code snippet:&amp;nbsp;&lt;A href="https://github.com/ArcGIS/arcgis-pro-sdk/wiki/ProSnippets-MapAuthoring#apply-symbology-to-a-layer-from-a-layer-file" target="_self"&gt;apply-symbology-to-a-layer-from-a-layer-file&lt;/A&gt;&amp;nbsp;(there are also a number of other snippets on the LayerDocument reference page).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 17:18:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-description-properties-with/m-p/1219048#M8832</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2022-10-05T17:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to access to layer description/properties with ArcGIS Pro SDK w/o instantiation the layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-description-properties-with/m-p/1219443#M8844</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;Thanks for the reply. I was able to use this for .lyrx extension but it does not work for the .lyr. All my files are .lyr files.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for the .lyr extension layer files I get this&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Amadeus111_0-1665073690429.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/52984i6B055BB58EF8C8AE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Amadeus111_0-1665073690429.png" alt="Amadeus111_0-1665073690429.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know if there is a solution for this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will mark your answer as a solution anyway since it gives a solution to my question.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 16:31:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-description-properties-with/m-p/1219443#M8844</guid>
      <dc:creator>Amadeus111</dc:creator>
      <dc:date>2022-10-06T16:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to access to layer description/properties with ArcGIS Pro SDK w/o instantiation the layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-description-properties-with/m-p/1219970#M8864</link>
      <description>&lt;P&gt;Hi Amadeus, i checked with the development team. Only JSON format is supported for LayerDocument. In Pro version 1.x, layer files with .lyr suffix could also be created with JSON format - hence the inclusion of both .lyr and .lyrx suffixes in the code example I referenced.&amp;nbsp;The API reference for &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic26514.html" target="_self"&gt;LayerDocument&lt;/A&gt; does correctly mention that .lyrx is the intended format.&lt;/P&gt;&lt;P&gt;Arcmap .lyr files, which are binary format, are not supported via LayerDocument. Therefore the only workaround would be to create the layer via LayerFactory (which I think u were trying to avoid).&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2022 17:25:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-description-properties-with/m-p/1219970#M8864</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2022-10-07T17:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to access to layer description/properties with ArcGIS Pro SDK w/o instantiation the layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-description-properties-with/m-p/1219978#M8866</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;Thanks for the inquisition, yes unfortunately I dont have lyrx option at the moment. I will see if I can solve this in another way. I will share it here if I do.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2022 17:47:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-description-properties-with/m-p/1219978#M8866</guid>
      <dc:creator>Amadeus111</dc:creator>
      <dc:date>2022-10-07T17:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to access to layer description/properties with ArcGIS Pro SDK w/o instantiation the layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-description-properties-with/m-p/1222473#M8895</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using one of the .lyrx files to get the info from the layer document.&lt;/P&gt;&lt;P&gt;I was able to get geometry type by using&amp;nbsp;JsonConvert.DeserializeObject(jsonfile)&lt;/P&gt;&lt;P&gt;but some of the info looks like in XML format&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Amadeus111_0-1666013375235.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/53760i6052778F7B2E1F8C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Amadeus111_0-1666013375235.png" alt="Amadeus111_0-1666013375235.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt; QueuedTask.Run(() =&amp;gt;
                {
                    LayerDocument lyrDocFromLyrxFile = new LayerDocument(layerPath);
                    var jsonfile = lyrDocFromLyrxFile.AsJson();
                    dynamic array = JsonConvert.DeserializeObject(jsonfile);
                    string nl = "\r\n";
                    var geometry = "Geometry: " + array.layerDefinitions[0].featureTemplates[0].tags.ToString() + nl;
                    var description = "Description: " + array.binaryReferences[0].data + nl; //This is in XML how can I read child nodes and convert to string
                
                    DescriptionTextBoxText = geometry + date.ToString();
                    
                });&lt;BR /&gt;&lt;BR /&gt;//Is there way to get child nodes in string?&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Oct 2022 13:34:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-description-properties-with/m-p/1222473#M8895</guid>
      <dc:creator>Amadeus111</dc:creator>
      <dc:date>2022-10-17T13:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to access to layer description/properties with ArcGIS Pro SDK w/o instantiation the layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-description-properties-with/m-p/1222585#M8899</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;Never mind, I figured it out.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;QueuedTask.Run(() =&amp;gt;
                {
                    LayerDocument lyrDocFromLyrxFile = new LayerDocument(layerPath);
                    var jsonfile = lyrDocFromLyrxFile.AsJson();
                    dynamic array = JsonConvert.DeserializeObject(jsonfile);
                    string nl = "\r\n";
                    var geometry = "Geometry : " + array.layerDefinitions[0].featureTemplates[0].tags.ToString() + nl;
                    var descriptionAll = array.binaryReferences[0].data.ToString();
                    var fufu = array.binaryReferences[0].uRI.ToString();


                    XmlDocument xmltest = new XmlDocument();
                    xmltest.LoadXml(descriptionAll);

                    string creationDate;
                    XmlNodeList xmlNodeListCreationDate = xmltest.GetElementsByTagName("CreaDate");
                    if (xmlNodeListCreationDate.Count &amp;gt; 0)
                        creationDate = "Creation Date : " + xmlNodeListCreationDate[0].InnerXml + nl;
                    else
                        creationDate = "Creation Date : No info" + nl;

                    string projection;
                    XmlNodeList xmlNodeListProjection = xmltest.GetElementsByTagName("projcsn");            
                    if(xmlNodeListProjection.Count &amp;gt; 0)
                       projection = "Projection : " + xmlNodeListProjection[0].InnerXml + nl;
                    else
                        projection = "Projection : No info" + nl;

                    string tags;
                    XmlNodeList xmlNodeListTags = xmltest.GetElementsByTagName("keyword");
                    if (xmlNodeListTags.Count &amp;gt; 0)
                        tags = "Tags : " + xmlNodeListTags[0].InnerXml + nl;
                    else
                        tags = "Tags : No info" + nl;

                    string description;
                    XmlNodeList xmlNodeListDescription = xmltest.GetElementsByTagName("idAbs");
                    if (xmlNodeListDescription.Count &amp;gt; 0)
                        description = "Description : " + xmlNodeListDescription[0].InnerXml + nl;
                    else
                        description = "Description : No info" + nl;

                    string credit;
                    XmlNodeList xmlNodeListCredit = xmltest.GetElementsByTagName("idCredit");
                    if (xmlNodeListCredit.Count &amp;gt; 0)
                        credit = "Credit : " + xmlNodeListCredit[0].InnerXml + nl;
                    else
                        credit = "Credit : No info" + nl;

                    string limitation;
                    XmlNodeList xmlNodeListLimitation = xmltest.GetElementsByTagName("useLimit");
                    if (xmlNodeListCredit.Count &amp;gt; 0)
                        limitation = "Use Limitations: " + xmlNodeListLimitation[0].InnerXml + nl;
                    else
                        limitation = "Use Limitations : No info" + nl;

                    DescriptionTextBoxText = geometry + creationDate + projection + tags + description + credit + limitation;
                });&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 17 Oct 2022 18:50:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-description-properties-with/m-p/1222585#M8899</guid>
      <dc:creator>Amadeus111</dc:creator>
      <dc:date>2022-10-17T18:50:50Z</dc:date>
    </item>
  </channel>
</rss>

