I am trying to do a chloropleth map of Belgian municipalities based on a tutorial I found for US counties. I am using a geoJson file of municipalities which looks to have the correct shape. So far the output is just a default world map with basic country shapes, without any of the municipalities/polygons.
My code is:
fig = px.choropleth(df, geojson=municipalities, locations='nsi', color='value',
color_continuous_scale="Viridis",
featureidkey = 'nsi',
range_color=(0, 1),
)
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
fig.show()
The geojson['features'] data structure is:
{'type': 'Feature',
'geometry': {'type': 'Polygon',
'coordinates': [[[5.120302925755441, 51.04816305680891],
[5.121797603837674, 51.047020715593455],
[...]
[5.120150449492362, 51.048366649842045],
[5.120302925755441, 51.04816305680891]]]},
'properties': {'nsi': '24020',
'geo_point_2d': [51.002047103149735, 5.067897449665062],
'name': 'Diest'},
'id': '24020'}
df is a pandas dataframe with two columns: nsi (string) and value (float), corresponding to the feature id. What am I doing wrong?