<?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: How to access to layer properties with C# and ArcGIS Pro SDK? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-properties-with-c-and/m-p/796093#M1784</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Cast the definition retrieved into CIMFeatureLayer. Like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="line-numbers language-csharp"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; lyrDef &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; shp_layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;GetDefinition&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; CIMFeatureLayer&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Mar 2020 17:44:07 GMT</pubDate>
    <dc:creator>UmaHarano</dc:creator>
    <dc:date>2020-03-03T17:44:07Z</dc:date>
    <item>
      <title>How to access to layer properties with C# and ArcGIS Pro SDK?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-properties-with-c-and/m-p/796092#M1783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created the layer but also I would like to retrieve layer properties such as geometry type, coord system etc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" height="494" src="https://community.esri.com/legacyfs/online/483913_pastedImage_1.png" width="500" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;System.Uri shp_filepath = new System.Uri(@shp_path);&lt;BR /&gt;QueuedTask.Run(() =&amp;gt;&lt;BR /&gt; {&lt;BR /&gt; var shp_layer = LayerFactory.Instance.CreateLayer&lt;BR /&gt; (shp_filepath, MapView.Active.Map, indexNumber, shp_path.Substring(16));&lt;BR /&gt; &lt;BR /&gt; //Get the active map view.&lt;BR /&gt; var mapView = MapView.Active;&lt;BR /&gt; var layerDescription = shp_layer.GetDefinition().Description; //This gives only the name but I need other properties too&lt;/P&gt;&lt;P&gt;if (mapView == null)&lt;BR /&gt; return Task.FromResult(false);&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt; var selectedLayer = mapView.GetSelectedLayers()[0];&lt;BR /&gt; &lt;BR /&gt; return mapView.ZoomToAsync(selectedLayer);&lt;BR /&gt; }&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2020 17:31:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-properties-with-c-and/m-p/796092#M1783</guid>
      <dc:creator>Amadeus111</dc:creator>
      <dc:date>2020-03-03T17:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to access to layer properties with C# and ArcGIS Pro SDK?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-properties-with-c-and/m-p/796093#M1784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Cast the definition retrieved into CIMFeatureLayer. Like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="line-numbers language-csharp"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; lyrDef &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; shp_layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;GetDefinition&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; CIMFeatureLayer&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2020 17:44:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-properties-with-c-and/m-p/796093#M1784</guid>
      <dc:creator>UmaHarano</dc:creator>
      <dc:date>2020-03-03T17:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to access to layer properties with C# and ArcGIS Pro SDK?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-properties-with-c-and/m-p/796094#M1785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I did that.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, How can I get coordination system and the geometry type as string?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Oz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2020 17:58:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-properties-with-c-and/m-p/796094#M1785</guid>
      <dc:creator>Amadeus111</dc:creator>
      <dc:date>2020-03-03T17:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to access to layer properties with C# and ArcGIS Pro SDK?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-properties-with-c-and/m-p/796095#M1786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Projection info can be accessed by&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var layer_projection = active_Layer.GetSpatialReference();
 projection_name = layer_projection.Name;&lt;/PRE&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;For the vector type, I just search through the Shape field in the attribute table.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&lt;SPAN style="color: #3d3d3d;"&gt;using (ArcGIS.Core.Data.Table shp_table = (active_Layer as FeatureLayer).GetTable())&lt;/SPAN&gt;&lt;BR style="color: #3d3d3d;" /&gt;&lt;SPAN style="color: #3d3d3d;"&gt;{&lt;/SPAN&gt;&lt;BR style="color: #3d3d3d;" /&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;using (RowCursor rowCursor = shp_table.Search())&lt;/SPAN&gt;&lt;BR style="color: #3d3d3d;" /&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/SPAN&gt;&lt;BR style="color: #3d3d3d;" /&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (rowCursor.MoveNext())&lt;/SPAN&gt;&lt;BR style="color: #3d3d3d;" /&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/SPAN&gt;&lt;BR style="color: #3d3d3d;" /&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;using (ArcGIS.Core.Data.Row row = rowCursor.Current)&lt;/SPAN&gt;&lt;BR style="color: #3d3d3d;" /&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/SPAN&gt;&lt;BR style="color: #3d3d3d;" /&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (row["Shape"] != null &amp;amp;&amp;amp; row["Shape"].ToString() != " ")&lt;/SPAN&gt;&lt;BR style="color: #3d3d3d;" /&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/SPAN&gt;&lt;BR style="color: #3d3d3d;" /&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;geometry_type = (string)row["Shape"].ToString();&lt;/SPAN&gt;&lt;BR style="color: #3d3d3d;" /&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;BR style="color: #3d3d3d;" /&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;BR style="color: #3d3d3d;" /&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;BR style="color: #3d3d3d;" /&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;BR style="color: #3d3d3d;" /&gt;&lt;SPAN style="color: #3d3d3d;"&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;This method still cannot help to distinguish between polygon and polygon ZM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:11:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-properties-with-c-and/m-p/796095#M1786</guid>
      <dc:creator>Amadeus111</dc:creator>
      <dc:date>2021-12-12T09:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to access to layer properties with C# and ArcGIS Pro SDK?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-properties-with-c-and/m-p/1120525#M7385</link>
      <description>&lt;P&gt;Thanks for posting this solution, it was something I needed to do. Have you found any other methods for determining the geometry type of a feature layer? Your posted solution works, BUT it is excruciatingly sloooow - it took over 15 seconds to determine the geometry type for 2 layers...&lt;/P&gt;</description>
      <pubDate>Sat, 27 Nov 2021 04:55:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-properties-with-c-and/m-p/1120525#M7385</guid>
      <dc:creator>BerndtNording</dc:creator>
      <dc:date>2021-11-27T04:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to access to layer properties with C# and ArcGIS Pro SDK?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-properties-with-c-and/m-p/1128112#M7518</link>
      <description>&lt;P&gt;Sorry, I just saw your message. Probably, there is a better solution for this but for a faster response, you can return after reading one row only. As we know,&amp;nbsp; shapefile geometry should be consistent for all the records on the attribute table. The solution above reads all rows before returning the geometry.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 18:42:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-properties-with-c-and/m-p/1128112#M7518</guid>
      <dc:creator>Amadeus111</dc:creator>
      <dc:date>2021-12-21T18:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to access to layer properties with C# and ArcGIS Pro SDK?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-properties-with-c-and/m-p/1128148#M7520</link>
      <description>&lt;P&gt;Yes, that is what I was doing, but still molasses slow. But I stumbled upon a solution that works much better: cast your featurelayer to a BasicFeatureLayer which has a ShapeType property. This little snippet creates a list of selected layers that match a specified geometry type. Fore some reason GeoNet doesn't give me the option for inserting "code".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dctLookup = new Dictionary&amp;lt;string, esriGeometryType&amp;gt;();&lt;BR /&gt;dctLookup.Add("POINT", esriGeometryType.esriGeometryPoint);&lt;BR /&gt;dctLookup.Add("LINE", esriGeometryType.esriGeometryPolyline);&lt;BR /&gt;dctLookup.Add("POLYGON", esriGeometryType.esriGeometryPolygon);&lt;/P&gt;&lt;P&gt;selLays = MapView.Active.GetSelectedLayers();&lt;BR /&gt;foreach (Layer lay in selLays)&lt;BR /&gt;if (lay.MapLayerType == MapLayerType.Operational)&lt;BR /&gt;{&lt;BR /&gt;pBFL = lay as BasicFeatureLayer;&lt;BR /&gt;if (pBFL != null)&lt;BR /&gt;{&lt;BR /&gt;for (int i = 0; i &amp;lt; lstTypes.Count; i++)&lt;BR /&gt;{&lt;BR /&gt;if (pBFL.ShapeType == dctLookup[lstTypes[i]])&lt;BR /&gt;{&lt;BR /&gt;lstLays[i] = lay;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;return lstLays;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 20:55:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-access-to-layer-properties-with-c-and/m-p/1128148#M7520</guid>
      <dc:creator>BerndtNording</dc:creator>
      <dc:date>2021-12-21T20:55:11Z</dc:date>
    </item>
  </channel>
</rss>

