74 map tiles to geotiff
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.
In [ ]:
Copied!
# %pip install -U leafmap
# %pip install -U leafmap
In [ ]:
Copied!
from leafmap import leafmap
from leafmap import leafmap
Create an interactive map.
In [ ]:
Copied!
m = leafmap.Map()
m
m = leafmap.Map()
m
Use the drawing tools to draw a rectangle on the map.
In [ ]:
Copied!
if m.user_roi is not None:
bbox = m.user_roi_bounds()
else:
bbox = [-122.5216, 37.733, -122.3661, 37.8095]
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.
In [ ]:
Copied!
leafmap.map_tiles_to_geotiff("satellite.tif", bbox, zoom=13, source="Esri.WorldImagery")
leafmap.map_tiles_to_geotiff("satellite.tif", bbox, zoom=13, source="Esri.WorldImagery")
In [ ]:
Copied!
leafmap.map_tiles_to_geotiff("topo.tif", bbox, zoom=13, source="OpenTopoMap")
leafmap.map_tiles_to_geotiff("topo.tif", bbox, zoom=13, source="OpenTopoMap")