Some FeatureLayers are added to map. How to retrieve one feature layer from map object? I have tried
map.getLayer(map.layerIds[x]), the object is not FeatureLayer type object.
with the following
map.getLayer('MapServiceWeb_Operational_7147');
you are getting the map layer setting the layer id.
Thank you so much for your guidance.
Baohoa,
A FeatureLayer is always added to the map.graphicsLayerIds array and not the map.layerIds array. So the code would look like:
map<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getLayer</SPAN><SPAN class="punctuation token">(</SPAN>map<SPAN class="punctuation token">.</SPAN>graphicsLayerIds<SPAN class="punctuation token">[</SPAN>x<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
Or if you know the exact layer id the you can use the code Panagiotis provided.
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.