To html

Export 3D maps as HTML files for website hosting
Uncomment the following line to install leafmap if needed.
| # %pip install "leafmap[maplibre]"
|
| import leafmap.maplibregl as leafmap
|
To run this notebook, you will need an API key from MapTiler. Once you have the API key, you can uncomment the following code block and replace YOUR_API_KEY with your actual API key. Then, run the code block code to set the API key as an environment variable.
| # import os
# os.environ["MAPTILER_KEY"] = "YOUR_PRIVATE_API_KEY"
# os.environ["MAPTILER_KEY_PUBLIC"] = "YOUR_PUBLIC_API_KEY"
|
| m = leafmap.Map(
center=[-122.19861, 46.21168], zoom=13, pitch=60, bearing=150, style="3d-terrain"
)
m.add_layer_control(bg_layers=True)
# m.to_html("terrain.html", title="Awesome 3D Map", width="100%", height="100%", replace_key=True)
m
|

| m = leafmap.Map(
center=[-74.0066, 40.7135], zoom=16, pitch=45, bearing=-17, style="basic-v2"
)
m.add_basemap("Esri.WorldImagery", visible=False)
m.add_3d_buildings(min_zoom=15)
m.add_layer_control()
# m.to_html("buildings.html", title="Awesome 3D Map", width="100%", height="100%", replace_key=True)
m
|