Image Overlay Example¶
This notebook demonstrates how to add georeferenced image overlays to a map using the add_image_layer method.
In [ ]:
Copied!
# %pip install anymap-ts
# %pip install anymap-ts
Basic Image Overlay¶
In [ ]:
Copied!
from anymap_ts import Map
m = Map(center=[-75.0, 42.0], zoom=5)
# Add an image overlay with corner coordinates
# Coordinates are: top-left, top-right, bottom-right, bottom-left
m.add_image_layer(
url="https://docs.mapbox.com/mapbox-gl-js/assets/radar.gif",
coordinates=[
[-80.425, 46.437], # top-left
[-71.516, 46.437], # top-right
[-71.516, 37.936], # bottom-right
[-80.425, 37.936], # bottom-left
],
opacity=0.8,
)
m
from anymap_ts import Map
m = Map(center=[-75.0, 42.0], zoom=5)
# Add an image overlay with corner coordinates
# Coordinates are: top-left, top-right, bottom-right, bottom-left
m.add_image_layer(
url="https://docs.mapbox.com/mapbox-gl-js/assets/radar.gif",
coordinates=[
[-80.425, 46.437], # top-left
[-71.516, 46.437], # top-right
[-71.516, 37.936], # bottom-right
[-80.425, 37.936], # bottom-left
],
opacity=0.8,
)
m
Export to HTML¶
In [ ]:
Copied!
m.to_html("image_overlay_example.html")
m.to_html("image_overlay_example.html")