Uncomment the following code blocks to install GDAL, leafmap, and localtileserver on SageMaker Studio Lab.
# %pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL
# pip install leafmap localtileserver matplotlib==3.6.3 folium==0.13.0
Restart the kernel after installing the packages.
import leafmap.foliumap as leafmap
Download a sample raster dataset.
url = "https://open.gishub.org/data/raster/srtm90.tif"
leafmap.download_file(url, "dem.tif")
Create an interactive map.
m = leafmap.Map()
m.add_raster("dem.tif", palette="terrain", layer_name="Local Raster")
m
Create a split-view map.
m = leafmap.Map()
m.split_map(
left_layer="dem.tif", right_layer="dem.tif", right_args={"palette": "terrain"}
)
m
m = leafmap.Map()
url = "https://github.com/opengeos/data/releases/download/raster/Libya-2023-07-01.tif"
m.add_cog_layer(url, name="COG")
m
m = leafmap.Map()
url = "https://github.com/opengeos/data/releases/download/raster/Libya-2023-07-01.tif"
url2 = "https://github.com/opengeos/data/releases/download/raster/Libya-2023-09-13.tif"
m.split_map(left_layer=url, right_layer=url2)
m
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=["pan"], name="Panchromatic")
m.add_stac_layer(url, bands=["B3", "B2", "B1"], name="False color")
m