@allmaps/basemap
The package generates the Allmaps basemap style.
Preview:

How it works
Section titled “How it works”The style follows the MapLibre Style Spec and has the following properties:
- Map data (city labels, roads, water features and other essential location context) is loaded via the Protomaps OSM Basemap. This is a 120GB basemap vector cartographic tileset created from OpenStreetMap and other open data sources and served using the PMTiles format.
- Terrain data is loaded using Mapterhorn, which provides a basemap raster tileset created from public terrain data and is also served using the PMTiles format.
- Styling similar to @allmaps/ui is applied, with custom Allmaps colors and fonts. Sprites are reused from the Protomaps style.
Installation
Section titled “Installation”This package works in browsers and in Node.js as an ESM module.
Install with pnpm:
pnpm install @allmaps/basemapIn a MapLibre map.
import { Map as MapLibreMap, addProtocol } from 'maplibre-gl'import { Protocol } from 'pmtiles'
import { basemapStyle } from '@allmaps/basemap'
let container: HTMLElement
let map: MapLibreMap
const protocol = new Protocol()addProtocol('pmtiles', protocol.tile)
map = new MapLibreMap({ container, // @ts-expect-error MapLibre types are incompatible style: basemapStyle('en')})License
Section titled “License”MIT
addTerrain(map, maplibregl, tiles)
Section titled “addTerrain(map, maplibregl, tiles)”Parameters
Section titled “Parameters”map(Map)maplibregl(unknown)tiles?(string | undefined)
Returns
Section titled “Returns”void.
basemapStyle(lang, glyphs, sprite, tileJson)
Section titled “basemapStyle(lang, glyphs, sprite, tileJson)”Parameters
Section titled “Parameters”lang(string)glyphs?(string | undefined)sprite?(string | undefined)tileJson?(string | undefined)
Returns
Section titled “Returns”{ version: 8; name?: string; metadata?: unknown; center?: Array<number>; zoom?: number; bearing?: number; pitch?: number; light?: LightSpecification; ... 5 more ...; layers: Array<LayerSpecification>; }.
removeTerrain(map)
Section titled “removeTerrain(map)”Parameters
Section titled “Parameters”map(Map)
Returns
Section titled “Returns”void.