Note
Go to the end to download the full example code.
Topographic tiles (SRTM relief)ΒΆ
A tiled basemap drawn from XYZ web tiles. OpenTopoMap renders SRTM elevation as shaded relief with contour lines, here over the northern French Alps. The tiles are fetched in Web Mercator, warped into the Lambert-93 map CRS and embedded as a single image, with the department boundaries drawn on top.
Tiles are cached on disk after the first download.
from mappyng import Map, TileLayer, VectorLayer
from mappyng.data import load_france_departments
deps = load_france_departments().to_crs(2154)
alps = deps[deps["COD_GEO"].isin(["74", "73", "38", "05", "26", "04"])]
# Landscape frame over the northern Alps (Lambert-93).
bbox_alps = [880000, 6390000, 1040000, 6560000]
m = Map(alps, bbox=bbox_alps, width=900, height=820, padding=20,
border_radius=8,
box_shadow={"dx": 3, "dy": 3, "blur": 6, "opacity": 0.2})
m.add(TileLayer(source="topo")) # OpenTopoMap: SRTM hillshade and contours
m.add(VectorLayer(alps, fill="none", stroke="#1a1a1a", stroke_width=0.6,
position="top"))
m.title("Northern French Alps", subtitle="Shaded relief from SRTM elevation")
m.scale_bar(length=25000, label="25 km", position={"x": 0.05, "y": 0.06},
opacity=0.85)
m.source("Tiles: OpenTopoMap (CC-BY-SA), SRTM | Boundaries: IGN ADMIN-EXPRESS")
Total running time of the script: (0 minutes 11.857 seconds)