Downloading maps tiles and converting them to a GeoTIFF file
Disclaimer: The leafmap.map_tiles_to_geotiff()
function is adapted from the tms2geotiff repo. Credit goes to the GitHub user @gumblex.
Uncomment the following line to install leafmap if needed.
# %pip install -U leafmap
from leafmap import leafmap
Create an interactive map.
m = leafmap.Map()
m
Use the drawing tools to draw a rectangle on the map.
if m.user_roi is not None:
bbox = m.user_roi_bounds()
else:
bbox = [-122.5216, 37.733, -122.3661, 37.8095]
Download map tiles and create a GeoTIFF file. First, let's try Esri world imagery basemap.
leafmap.map_tiles_to_geotiff("satellite.tif", bbox, zoom=13, source="Esri.WorldImagery")
leafmap.map_tiles_to_geotiff("topo.tif", bbox, zoom=13, source="OpenTopoMap")