go.Scattergeo with geojson and featureidkey: the map is not drawn

Iā€™ve problem similar to another problem submitted to the forum and solved a few months ago and therefore Iā€™m referring to previous post and to the data used in it.

In the reply to this post

Emmanuelle showed how to use geojson and featureidkey attributes in a go.Choropleth trace, as in following code

import json
from urllib.request import urlopen
import pandas as pd
import numpy as np
import plotly.graph_objects as go
df = pd.read_csv(ā€˜https://raw.githubusercontent.com/FBosler/covid19-dash-app/master/functions/data.csvā€™)
counties = json.load(open(ā€œcounties.jsonā€))
URL = ā€œhttps://raw.githubusercontent.com/FBosler/covid19-dash-app/master/functions/counties.jsonā€
with urlopen(URL) as response:
counties = json.load(response)
trace = go.Choropleth(
geojson=counties,
z=np.log10(df[ā€˜infectedā€™]),
locations=df[ā€˜Landkreisā€™],
featureidkey=ā€œproperties.NAME_3ā€)
fig = go.Figure(data=trace)
fig.update_geos(fitbounds=ā€œlocationsā€)
fig.show()

Iā€™m trying to create a go.Scattergeo plot with geojson and featureidkey attributes (see following code), but the output is not the expected one. The markers are shown and the map defined in geojosn file is not shown. What is missing in my example?
Next step will be to animate the scatter plot, with the size of the markers changing in each frame, but by now Iā€™m trying to draw a static plot.
Thanks in advance for your help

Mauro

trace = go.Scattergeo(
marker=dict(size=df[ā€˜infectedā€™],
sizemode=ā€œareaā€),
geojson=counties,
locations=df[ā€˜Landkreisā€™],
featureidkey=ā€œproperties.NAME_3ā€)
fig = go.Figure(data=trace)
fig.update_geos(fitbounds=ā€œlocationsā€)
fig.show()

problem solved, two traces are required, that is:

  • a static go.Choropleth trace with the map
  • a dynamic go.Scattergeo bubble trace, with a set of frames for animation

If anyone is interested, a draft solution is here:

https://github.com/to-mg/someTests/blob/main/go.Choropleth.Scattegeo.animated.py