Skip to main content

Function: basemap()

basemap(theme?): Basemap

Defined in: packages/sdvplot/src/maplibre.ts:425

A free basemap that needs no API key: OpenFreeMap's positron (light) or dark vector style, built from OpenStreetMap data. Pass style to new maplibregl.Map({ style }). OpenFreeMap's public instance asks for no registration or key and sets no request limit; the credit is required, and MapLibre's attribution control shows it from the style's source (attribution is the same text, for anything else). Each map view requests the provider's tiles: build or test pages without a map, or serve a local style.

Parameters​

theme?​

"dark" | "light"

Returns​

Basemap

Example​

import { basemap } from "@sportsdataverse/sdvplot/maplibre";

const { style, background } = basemap("dark");
// in the browser: new maplibregl.Map({ container, style, center: [-96, 38], zoom: 3 })
[style, background];