皆さん、こんにちは。
フィーチャ サービスを1つだけ含むマップ ビューアーを使っています。マップ ビューアーの編集ツールをクリックして複数のフィーチャを選択すると、選択したフィーチャのオブジェクトIDが表示されます。編集ツールに表示されるフィールドを、もっと分かりやすいものに変更するにはどうすればよいでしょうか(画像をご覧ください)。
簡単にできそうな気がしますが、フィーチャ レイヤーやWebビューアーのオプションを長い間調べても、変更する方法が見つかりません。
ありがとうございます。
Lee
Hi @Lee_Butler
You can use the python script below to achieve this. You will need to fill in the feature service id, the layer name, and the field name you want to change the displayField to.
from arcgis.gis import GIS ## connect to AGOL agol = GIS("home") ## the item id for the feature service to update item_id = "FEATURE_SERVICE_ID" ## access the feature service item = agol.content.get(item_id) ## the name of the layer within the feature service lyr_name = "Layer_Name" ## the field name you want to use as the display field field_name = "Field_Name" ## access the layer lyr = [lyr for lyr in item.layers if lyr.properties.name == lyr_name][0] ## use this dictionary to update update_dict = { "displayField" : field_name } ## update the layer definition print(lyr.manager.update_definition(update_dict))
This is being driven by the display service set when publishing the feature service. You can overwrite the service or go through the admin REST api and do update definition .
The service was published from Survey123. Do you know if there is a setting in Survey123 to change this? I can't see anything obvious.
Thanks
Hi @Clubdebambos,
Thanks for this script. It works great. Much appreciated
Hi, is there a way to do this without using python? Is there a way to change the field display right in the new map viewer? Thank you
You can manually change the layer's "displayField" setting in REST services using the Update Definition operation. It does not appear that you can customize this setting for each Web Map, since they just reference the layer's definition. If you needed a different Display Field for different Web Maps, you would need to create view layers for each.
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.