Skip to content

@allmaps/basemap

The package generates the Allmaps basemap style.

Preview:

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.

This package works in browsers and in Node.js as an ESM module.

Install with pnpm:

Terminal window
pnpm install @allmaps/basemap

In 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')
})

MIT

  • map (Map)
  • maplibregl (unknown)
  • tiles? (string | undefined)

void.

basemapStyle(lang, glyphs, sprite, tileJson)

Section titled “basemapStyle(lang, glyphs, sprite, tileJson)”
  • lang (string)
  • glyphs? (string | undefined)
  • sprite? (string | undefined)
  • tileJson? (string | undefined)

{ version: 8; name?: string; metadata?: unknown; center?: Array<number>; zoom?: number; bearing?: number; pitch?: number; light?: LightSpecification; ... 5 more ...; layers: Array<LayerSpecification>; }.

  • map (Map)

void.