使用API for Python时未加载ArcGIS Online Dashboard

2024-06-23 19:14:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试创建一个WebMap,它将用作ArcGIS仪表板中的小部件。我是通过ArcGIS API for Python来实现这一点的。我成功创建了仪表板,我可以在ArcGIS online的内容中看到它。然而,当我点击仪表板时,什么也没有加载,我看到的只是一个空白屏幕

每当我尝试用这个API创建网络地图时,我都会遇到同样的问题。当我点击网络地图时,我只看到一个空白屏幕。但是,我可以通过单击“在MapView Classic中打开”来解决这个问题。当然,没有在Dashboard Classic中打开选项,所以我一直在解决这个问题。提前谢谢

#Creating WebMap that will become a widget in the dashboard

from arcgis.mapping import WebMap

search = g.content.search(title, item_type="Feature Layer")
map = WebMap()
item = search[0]
map.add_layer(item)
props = {'title': title,
         'snippet': 'hwa',
         'tags': 'python',
         "renderer": "autocast",
         "field_name": "Threat",
         }
map.save(props)

g.content.search(title, item_type='Web Map')[0].share(everyone=True)
g.content.search(title, item_type='Feature Layer')[0].share(everyone=True)
g.content.search(title, item_type='CSV')[0].share(everyone=True)


#Creating Dashboard

from arcgis.apps.dashboard import Dashboard, add_column, add_row
dashboard = Dashboard()
dashboard.layout = add_row(WebMap (map))
dashboard.save("Sample Dashboard")

g.content.search(query="title:Sample Dashboard1", item_type='Dashboard') 
[0].share(everyone=True)

Tags: addtruesharemapsearchtitletype仪表板

热门问题