Skip to content
LoidoltTheme 0.11.1
Svelte 5

Component

MapSource

GeoJSON (or any MapLibre source) for the layers inside it, with optional clustering.

import { MapSource } from '@loidolt/theme-maps';

Example

Focus the map to move it: arrow keys pan, plus and minus zoom, Shift with the arrows rotates and tilts.

Notes

  • Replace the data object to update the map in place; the layers drawing it are untouched.
  • Layers inside a MapSource pick up its id. Clusters come with clusterColor(), clusterRadius() and expandCluster() from /core.

Props

Generated from the component source, so it cannot drift from the implementation.

MapSource props
PropTypeDefaultNotes
id required string—Unique on the map; layers name it as their source.
attribution string—Credit shown in the attribution control.
children Snippet—Layers drawn from this source. They pick up its id without naming it.
cluster boolean | ClusterOptionsfalseGather nearby points into clusters.
data GeoJSON | string—GeoJSON, or a URL to fetch it from. Replace the object to update the map.
promoteId string—A feature property to use as its id, for hover state and LayerManager.
spec Record<string, unknown>—Any other MapLibre source — vector or raster tiles, an image — as its specification.