33 image overlay
Uncomment the following line to install leafmap if needed.
In [1]:
Copied!
# !pip install leafmap
# !pip install leafmap
In [2]:
Copied!
import os
from leafmap import leafmap
import os
from leafmap import leafmap
Using local files
Download the sample png from https://i.imgur.com/06Q1fSz.png to your Downloads
folder.
In [3]:
Copied!
filepath = "weather.png"
url = "https://open.gishub.org/data/images/weather.png"
if not os.path.exists(filepath):
leafmap.download_file(url, filepath)
filepath = "weather.png"
url = "https://open.gishub.org/data/images/weather.png"
if not os.path.exists(filepath):
leafmap.download_file(url, filepath)
Downloading... From: https://open.gishub.org/data/images/weather.png To: /home/runner/work/leafmap/leafmap/docs/notebooks/weather.png
0%| | 0.00/489k [00:00<?, ?B/s]
100%|██████████| 489k/489k [00:00<00:00, 78.4MB/s]
In [4]:
Copied!
m = leafmap.Map(center=(25, -115), zoom=4)
image = leafmap.ImageOverlay(url=filepath, bounds=((13, -130), (32, -100)))
m.add_layer(image)
m
m = leafmap.Map(center=(25, -115), zoom=4)
image = leafmap.ImageOverlay(url=filepath, bounds=((13, -130), (32, -100)))
m.add_layer(image)
m
Using remote files
In [5]:
Copied!
m = leafmap.Map(center=(25, -115), zoom=4)
image = leafmap.ImageOverlay(url=url, bounds=((13, -130), (32, -100)))
m.add_layer(image)
m
m = leafmap.Map(center=(25, -115), zoom=4)
image = leafmap.ImageOverlay(url=url, bounds=((13, -130), (32, -100)))
m.add_layer(image)
m
Update image url
In [6]:
Copied!
# image.url = "https://i.imgur.com/J9qCf4E.png"
# image.url = "https://i.imgur.com/J9qCf4E.png"