58 bokeh

Uncomment the following line to install leafmap if needed.
| # !pip install bokeh jupyter_bokeh
|
| import leafmap.bokehmap as leafmap
|
Create an interactive map
Specify center and zoom level
| m = leafmap.Map(center=[40, -100], zoom=4, height=400)
m
|
Add basemaps
| m = leafmap.Map()
m.add_basemap("OpenTopoMap")
m
|
| # print(leafmap.basemaps.keys())
|
Add COG
| m = leafmap.Map()
url = "https://github.com/opengeos/data/releases/download/raster/Libya-2023-09-13.tif"
m.add_cog_layer(url)
m
|
Add STAC
| m = leafmap.Map()
url = "https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json"
m.add_stac_layer(url, bands=["B3", "B2", "B1"], name="False color")
m
|
Add local raster datasets
| url = "https://opengeos.org/data/raster/srtm90.tif"
leafmap.download_file(url, "dem.tif")
|
| m = leafmap.Map()
m.add_raster("dem.tif", colormap="terrain")
m
|
Add points
| m = leafmap.Map()
url = "https://github.com/opengeos/leafmap/blob/master/examples/data/us_cities.geojson"
m.add_geojson(url, size=10, color="blue", alpha=0.7)
m
|
Add lines
| m = leafmap.Map()
m.add_basemap("CartoDB.DarkMatter")
url = "https://github.com/opengeos/datasets/releases/download/vector/cables.geojson"
m.add_vector(url, line_color="color", line_width=2)
m
|
Add polygons
| m = leafmap.Map()
url = "https://github.com/opengeos/leafmap/blob/master/examples/data/countries.geojson"
m.add_vector(url, fill_alpha=0.5, fill_color="lightblue")
m
|