Select to view content in your preferred language

Add Webmap into a Dashboard

535
1
Jump to solution
07-11-2023 09:17 AM
Labels (1)
GarrettLee
New Contributor

I am trying to add a WebMap object to my dashboard that I am creating:

 

dashboard = Dashboard()
dashboard.title = "My Network"

indicator04 = Indicator(item = feature_layer_item, name = "KPI 1", title = "KPI 1")
indicator04.data.value_type = "statistic"
indicator04.data.value_field = "kpi1"
indicator04.height=0.1

my_webmap = WebMap()
my_webmap.add_layer(feature_layer_item, options={'title':'Links'})

dashboard.layout = add_column([indicator04, my_webmap])

 

 

The error that I get is this:

 

---------------------------------------------------------------------------
Warning                                   Traceback (most recent call last)
In  [36]:
Line 1:     dashboard.layout = add_row([add_column([indicator04, my_webmap])])

File C:\Users\MyUser1\AppData\Local\Programs\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\apps\dashboard\_utils\_basewidget.py, in add_column:
Line 401:   elements = _auto_calculate_width(elements)

File C:\Users\MyUser1\AppData\Local\Programs\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\apps\dashboard\_utils\_basewidget.py, in _auto_calculate_width:
Line 295:   element_width = getattr(el, "width", 1)

File C:\Users\MyUser1\AppData\Local\Programs\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\mapping\_types.py, in width:
Line 2424:  raise Warning(

Warning: This property is no longer supported and does not operate on the resource.

 

In addition, when I access my dashboard, I am getting a blank screen. 

I tried around a couple of things and the following code blocks work:

 

# Generates a dashboard with only the indicator
dashboard.layout = add_column([indicator04])

# Yields <class 'arcgis.features.layer.FeatureLayer'>
type(feature_layer)

# Yields a WebMap with my desired layer
my_webmap

 

Is there another way for me to add the WebMap to the dashboard? There does not seem to be many directions on how to do this when creating a new dashboard at the same time.

Note: This error happens for add_column([indicator04, my_webmap]) and add_row([indicator04, my_webmap]) as well.

0 Kudos
1 Solution

Accepted Solutions
David_McRitchie
Esri Contributor

Hey Garett,

This code is trying to use an unsupported method to create a dashboard as this was the method to create a Classic Dashboard. This is highlighted under this part of the documentation - https://developers.arcgis.com/python/api-reference/arcgis.apps.dashboard.html 

Unfortunately, I do not believe there is a replacement for this at the moment so a web map will need to be created and a dashboard manually created from this.

Hope that helps,

David

 

 

 

Esri UK -Technical Support Analyst

View solution in original post

1 Reply
David_McRitchie
Esri Contributor

Hey Garett,

This code is trying to use an unsupported method to create a dashboard as this was the method to create a Classic Dashboard. This is highlighted under this part of the documentation - https://developers.arcgis.com/python/api-reference/arcgis.apps.dashboard.html 

Unfortunately, I do not believe there is a replacement for this at the moment so a web map will need to be created and a dashboard manually created from this.

Hope that helps,

David

 

 

 

Esri UK -Technical Support Analyst