i want to mark points(using latitude and longitude) from pandas data frame using plotly python with satellite view. sample df:
device GPSTime GPSLat GPSLng
101 1614956574 16.94469 29.8267
102 1615271467 16.94503 29.83
103 1615271488 16.94553 29.83
i plot the data using Plotly but didn't get the satellite view. Is there any way to get a satellite view for this?
mycode:
import plotly.express as px
fig = px.scatter_mapbox(dfL, lat="GPSLat", lon="GPSLng", zoom=15, height=500,width=1000,color="device")
fig.update_layout(mapbox_style="open-street-map")
fig.show()
current view: enter image description here
But I need to plot these data on satalite image? Is there any way to get a satellite view for this?
First, if you want to use mapbox, you need to get the APIKey of mapbox . Once you have the APIKey, you can use the following code to draw the satellite image with the style specified.
import plotly.express as px
px.set_mapbox_access_token(open("mapbox_api_key.txt").read())
fig = px.scatter_mapbox(df,
lat=df.GPSLat,
lon=df.GPSLng,
hover_name="device",
height=500, width=1000,
zoom=15, mapbox_style='satellite')
fig.show()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.