Mapbox - 3D Terrain¶
Mapbox DEM terrain, pitch, and atmospheric effects.
In [ ]:
Copied!
# %pip install anymap-ts
# %pip install anymap-ts
Add Terrain with Mapbox DEM¶
In [ ]:
Copied!
from anymap_ts import MapboxMap
m = MapboxMap(
center=[-122.4, 37.8],
zoom=11,
pitch=60,
style="mapbox://styles/mapbox/satellite-streets-v12",
)
m.add_terrain(exaggeration=1.5, source="mapbox-dem")
m
from anymap_ts import MapboxMap
m = MapboxMap(
center=[-122.4, 37.8],
zoom=11,
pitch=60,
style="mapbox://styles/mapbox/satellite-streets-v12",
)
m.add_terrain(exaggeration=1.5, source="mapbox-dem")
m
Set Pitch for 3D View¶
Pitch is set in the constructor (60 degrees above). For a steeper view, create a new map with higher pitch.
In [ ]:
Copied!
# Fly to a location to see terrain in 3D
m.fly_to(-122.4, 37.85, zoom=13)
# Fly to a location to see terrain in 3D
m.fly_to(-122.4, 37.85, zoom=13)
Set Fog Atmospheric Effects¶
In [ ]:
Copied!
m.set_fog(
color="#ffffff",
high_color="#add8e6",
low_color="#87ceeb",
horizon_blend=0.5,
range=[0.5, 10],
)
m.set_fog(
color="#ffffff",
high_color="#add8e6",
low_color="#87ceeb",
horizon_blend=0.5,
range=[0.5, 10],
)
Remove Terrain¶
In [ ]:
Copied!
m.remove_terrain()
m.remove_fog()
m.remove_terrain()
m.remove_fog()