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 = '06Q1fSz.png'
if not os.path.exists(filepath):
leafmap.download_from_url("https://i.imgur.com/06Q1fSz.png", filepath)
filepath = '06Q1fSz.png'
if not os.path.exists(filepath):
leafmap.download_from_url("https://i.imgur.com/06Q1fSz.png", filepath)
Downloading https://i.imgur.com/06Q1fSz.png ... Data downloaded to: /home/runner/work/geospatial-notebooks/geospatial-notebooks/docs/leafmap/06Q1fSz.png
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="https://i.imgur.com/06Q1fSz.png", bounds=((13, -130), (32, -100))
)
m.add_layer(image)
m
m = leafmap.Map(center=(25, -115), zoom=4)
image = leafmap.ImageOverlay(
url="https://i.imgur.com/06Q1fSz.png", 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"
Last update:
2022-03-14