I have an altair world map with some data projected on it (gps-points). I can scale the map, but when I translate the map (moving it) then I get an error:
AttributeError: 'list' object has no attribute 'get'
When i delete the part:
translate=[100, 550]
the map is shown, but i wanna show a different zone of the world. Why is this error?
This is my code for displaying the map:
# World background
world = alt.topo_feature(data.world_110m.url, 'countries')
background = alt.Chart(world).mark_geoshape(fill='lightgray',
stroke='white').properties(width=800,height=800).project(type='mercator', scale=300,
translate=[100, 550])
# gps position *.jpg photos
points = alt.Chart(df).mark_circle().encode(
latitude='latitude',
longitude='longitude',
color=alt.value('steelblue'),
tooltip=['naam']
).project(scale=300)
st.altair_chart(background + points, use_container_width=True)
The issue is that you have an unsupported version of jsonschema
; see https://github.com/altair-viz/altair/issues/2496
If you pip install jsonschema<4.0
, the chart should work as written. Alternatively, you can update to an Altair version newer than 4.1 (currently 4.2.0.rc1 is available, and the final 4.2.0 release should happen soon).