'Showing gps points on altair world map

I'm building (for learning purposes) a python program that extracts gps-data from *jpg files in a directory and display the gps-coordinates from the photo's on a world-map.

I managed to extract the latitude and longitude values in a panda's dataframe and display it on a altair-world map.

But my problem is that the points don't show up in the right gps position. Also when i pan the map the points move around the map and the map selve doesn't move.

How can i manage to get the points fixed on a world map and in the right gps-position?

This is my code for the altair-map:

world = alt.topo_feature(data.world_110m.url, feature='countries')

# US states background
background = alt.Chart(world).mark_geoshape(
fill='lightgray',
stroke='white'
).properties(
width=1300,
height=900
)

# airport positions on background
points = alt.Chart(df).mark_circle().encode(
x='latitude',
y='longitude',
color=alt.value('steelblue'),
tooltip=['naam']
).interactive()

st.altair_chart(background + points, use_container_width=True)

This is a part of my dataframe:

     naam   latitude longitude
1    photo1  46.073822  6.109725
2    photo2 46.123119  6.205319
3    photo3 46.1232  6.205728

This is my map-display in streamlit with gps-data individual photos

Thnx in advanced!!



Solution 1:[1]

Solved in the comments, adding as an answer to mark this as solved:

Try changing x='latitude', y='longitude' to latitude='latitude', longitude='longitude'. This may require you to delete .interactive(), because Altair produces Vega-Lite, which apparently does not support geographic chart interactivity: github.com/altair-viz/altair/issues/1555

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1