Skip to content

74 map tiles to geotiff

image image image

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.

1
# %pip install -U leafmap
1
from leafmap import leafmap

Create an interactive map.

1
2
m = leafmap.Map()
m

Use the drawing tools to draw a rectangle on the map.

1
2
3
4
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.

1
leafmap.map_tiles_to_geotiff("satellite.tif", bbox, zoom=13, source="Esri.WorldImagery")

1
leafmap.map_tiles_to_geotiff("topo.tif", bbox, zoom=13, source="OpenTopoMap")