Creating Dashboard elements with GeoJSON

02-08-2021 10:25 AM
New Contributor

Hello! So we have been using the ArcGIS Dashboard for some time and we are now making use of the recently added submodule arcgis.apps.dashboard.

One of the issuess we are facing is creating a dashboard elements(charts,gauge etc) with GeoJSON related data. When the Python API tries to create a Dashboard chart element, it usually looks after table data. But since we are dealing with GeoJSON, the data it is stored in propertie objects and not tables.

File "D:\Anaconda\envs\agol_env\lib\site-packages\arcgis\apps\dashboard\_gauge\", line 507, in objectid_field

    return self._item.tables[0].properties["objectIdField"]

IndexError: list index out of range

Creating dashboard elements with GeoJSON related object works fine manually on the ArcGIS Online website.

0 Kudos
3 Replies
Esri Contributor

Hi @Wirescan ,

No sure exactly what you're trying to achieve.

Is it possible to share your script?

0 Kudos
New Contributor

All 3 elements are taking advantage of the same feature layer. The difference is that element 3 is requiring it through a webmap widget.

Here is the script:


item_name= 'Faerder Cable Network As Found'
item_geojson_related ='title: "{0}"'.format(item_name), max_items=1, item_type='Feature Layer')[0]

webmap_name = 'Faerder Windmill Park Static View'
webmap_item ='title: "{0}"'.format(webmap_name), max_items=1, item_type='Web Map')[0]
webmap = WebMap(webmap_item)

# Element 1 - Cable Capacitance
capacitance_chart = SerialChart(item_geojson_related, name='Cable Capacitance', categories_from='features', description='Cable Capacitance') = 'CableID''Measureed Capacitance (pF/m)')

# Element 2 - Cable Inductance
inductance_chart = SerialChart(item_geojson_related, name='Cable Inductance', categories_from='features', description='Cable Inductance') = 'CableID''Measured Inductance (micro Henry/m)')

# Element 3 - Gauge
gauge = Gauge(webmap, name='Average Delta G in Visible Cable Network', layer=0, description='Average Delta G in Visible Cable Network') = 'statistic' = 'Average' = 'Delta_G'
gauge.gauge_options.shape = 'horseshoe'


Element 1&2 returns this error:

  File "C:/Users/Henrik/AppData/Roaming/JetBrains/PyCharmCE2020.2/scratches/", line 23, in <module> = 'CableID'
  File "D:\Anaconda\envs\agol_env\lib\site-packages\arcgis\apps\dashboard\_serialchart\", line 916, in category_field
    if self._field_type(value) == '<M8[ns]':
  File "D:\Anaconda\envs\agol_env\lib\site-packages\arcgis\apps\dashboard\_serialchart\", line 1048, in _field_type
    f_type = self._item.tables[0].query().sdf[field_name].dtype
IndexError: list index out of range


0 Kudos
New Contributor

I also have the same issue like @Wirescan. When will this bug be fixed?

0 Kudos