I try to plot an aircraft route overlaying an open street map, i.e. I have Latitude, Longitude and altitude and would like to do a 3d scatter on top of the mapping object in python.
I have searched for a simple solution but cannot find one. Any advice?
Here is a simple, non-working example.
import plotly.graph_objects as go
lon = [15.3, 15.35, 15.4]
lat = [58.3, 60.7, 64.2]
altitude = [1000, 2000, 3000] # How do I pass this information to the scatterplot??
fig = go.Figure(go.Scattermapbox(
mode="markers+lines",
lon=lon,
lat=lat,
marker={'size': 10},
),
)
fig.update_layout(
margin={'l': 0, 't': 0, 'b': 0, 'r': 0},
mapbox={
'style': "open-street-map",
'center_lat': lat[0],
'center_lon': lon[0],
'zoom': 6
},
)
Thank you for the response. I tried adding scatter3D, however it creates a new axis on top of the mapbox, thus not a working solution. Do you know if there is a way to override this?
@marba751 This old plot https://chart-studio.plotly.com/~empet/14375/map-of-france-regions-data-source-1/#/ can suggest how you can create a 3d scatter over a map.
As I can remember, the data for France map have been extracted from a geojson file. The map is drawn on the plane z=0. On xaxis is longitude and on yaxis the latitude of points on the lines retrieved from the geojson file , i.e. you should define: