@allmaps/basemap
v1.0.0-beta.9
Published
Allmaps Basemap style for MapLibre
Readme
@allmaps/basemap
The package generates the Allmaps basemap style.
Preview:

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
This package works in browsers and in Node.js as an ESM module.
Install with pnpm:
pnpm install @allmaps/basemapUsage
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')
})License
MIT
API
addTerrain(map, maplibregl, tiles)
Parameters
map(Map)maplibregl(unknown)tiles?(string | undefined)
Returns
void.
basemapStyle(lang, glyphs, sprite, tileJson)
Parameters
lang(string)glyphs?(string | undefined)sprite?(string | undefined)tileJson?(string | undefined)
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)
Parameters
map(Map)
Returns
void.
