I have a feature layer collection with 3 layers, and I only want to perform analysis on one of the 3 layers. What is the method for assigning only that one layer of interest to a variable that I can perform analysis on? Thanks
Hello Konrad,
Something like this would work.....
<SPAN class="keyword token">import</SPAN> arcgis <SPAN class="keyword token">from</SPAN> arcgis<SPAN class="punctuation token">.</SPAN>gis <SPAN class="keyword token">import</SPAN> GIS gis <SPAN class="operator token">=</SPAN> GIS<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Grab the feature layer item by id</SPAN> featureLayerItem <SPAN class="operator token">=</SPAN> gis<SPAN class="punctuation token">.</SPAN>content<SPAN class="punctuation token">.</SPAN>get<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'c7c2420dfa884f34890da0a78b6a0533'</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#Print out layer 0 from the layer list</SPAN> <SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>featureLayerItem<SPAN class="punctuation token">.</SPAN>layers<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Essentially, you can call the "layers" property which gives you back a list. Then you can access an item from that list by using the square bracket notation.
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.