Historical Maps - GeoServer WMTS Layers
The EPFL Time Machine GeoServer at geo-timemachine.epfl.ch serves historical maps of Lausanne as WMTS raster tile layers. This page shows how to use them in Leaflet.
Available Layers
The GeoServer exposes 31 Lausanne historical maps spanning from 1721 to 1970. Select one below to view it:
The key pattern here is two separate cells: one that creates the map (no dependency on selectedLayer, so it runs only once), and one that adds the historical tile layer (depends on selectedLayer, so it re-runs on every change). The invalidation promise removes the old tile layer before the new one is added.
All Layers as Toggleable Overlays
For a map where users can toggle between all historical layers at once, use L.control.layers. Here all layers are added as overlays (OSM remains the base):
With many layers, the Leaflet layer control can get long. For a polished UI, consider using a view(Inputs.select(...)) input (as shown above) instead of the built-in control.
The WMTS URL Pattern
The GeoServer exposes layers via the WMTS REST API. The URL template is:
https://geo-timemachine.epfl.ch/geoserver/gwc/service/wmts/rest/
TimeMachine:{layerName}/
{style}/
{TileMatrixSet}/
{TileMatrixSet}:{z}/{y}/{x}
?format=image/png
Key parameters for Lausanne layers:
| Parameter | Value |
|---|---|
style |
raster |
TileMatrixSet |
EPSG:900913x2 |
format |
image/png |
In Leaflet, pass these as options to L.tileLayer:
L.tileLayer(
"https://geo-timemachine.epfl.ch/geoserver/gwc/service/wmts/rest/TimeMachine:1831_Berney/{style}/{TileMatrixSet}/{TileMatrixSet}:{z}/{y}/{x}?format=image/png",
{
style: "raster",
TileMatrixSet: "EPSG:900913x2",
tms: false,
attribution: '© EPFL Time Machine Unit'
}
)