m
maplibre-gl-dates
Filter a time-enabled map by date
Maintained by OpenHistoricalMap
A MapLibre GL JS plugin from OpenHistoricalMap that filters every layer of a style to the features that existed on a given date, for historical maps built on OpenHistoricalMap vector tiles.
Live demo
maplibre-gl-dates running on MapLibre GL JS in your browser
Loading the map…
Demo code
import { filterByDate } from "@openhistoricalmap/maplibre-gl-dates";
import type { PluginDemo } from "../types";
export default {
center: [15, 49], // Central Europe
zoom: 4,
async run({ map }) {
// The plugin filters time-enabled data, so switch to OpenHistoricalMap's own style.
map.setStyle("https://www.openhistoricalmap.org/map-styles/main/main.json");
await map.once("style.load");
// Show the map as it was on the eve of the First World War.
filterByDate(map, "1914-06-28");
},
} satisfies PluginDemo;
