Skip to content

Upgrading to 0.10

This page is the release history of maplibre-yaml for anyone with a map that already works: how to move it to the current release, and what changed in each release line, newest first. The current line is 0.10: @maplibre-yaml/core 0.10, @maplibre-yaml/astro 0.8 and @maplibre-yaml/cli 0.6. Most maps upgrade with no change to their YAML.

Each package’s changelog on npm has the complete list of changes.

A project keeps the version it was set up with: nothing moves to 0.10 until you change it.

The version is part of the script’s address. Use the current release line in the register.js line of your page:

<script
type="module"
src="https://unpkg.com/@maplibre-yaml/core@0.10/register.js"
></script>

The number after core@ names a release line: the address loads the newest release in that line, so bug fixes arrive by themselves, but a new line, which may behave differently, arrives only when you change the number (Versions in CDN URLs). A story page (<ml-scrollytelling>) uses the same script.

If you load the JavaScript API from esm.sh, change the number in that address the same way: https://esm.sh/@maplibre-yaml/core@0.10?external=maplibre-gl.

0.10 makes a map follow its document: a changed document updates the running map in place instead of rebuilding it, a page script reads and writes the document’s state: values, and the camera no longer resets when the document changes. Documents can also be written in JSON or TOML, and large files draw at more zooms with less preparation.

Your YAML keeps working, and a page that renders one document once sees no change. These are the differences on a page that changes a map’s document after it has loaded (a config assigned again, a changed src, reload()), and what to do about each, if anything.

  • A changed document updates the map in place. Before, any new document tore the map down and built a new one. Now the element validates the new document, then changes only what differs from the one the map shows: layers and sources by id, properties through MapLibre’s setters, the legend, panel, markers and popups after them. The map, your listeners and your own layers stay. ml-map:update-applied fires with a summary of what changed; an invalid document is refused with ml-map:update-rejected and the map kept, where before the error card replaced it. Only a changed mapStyle still rebuilds the map, at the current camera. reload() works the same way, and retries sources whose last load failed. (Updating the document)

  • The camera no longer resets to the document’s. Before, a new document opened at its center and zoom because the map was rebuilt. Now the camera moves only when the document’s center, zoom, bearing, pitch or fitTo changed; a reader who panned the map keeps their view across an update that recolours a layer. A page that relied on the reset (a “start over” button that assigned the document again) re-applies the document camera itself on ml-map:update-applied:

    el.addEventListener("ml-map:update-applied", () => {
    const { center, zoom, bearing, pitch } = el.getDocument().config;
    el.getMap().jumpTo({ center, zoom, bearing, pitch });
    });

    The opposite case is a page whose readers pan the map themselves while its document keeps changing (a dashboard that refreshes its data): add camera="host" to the element (the camera prop in React and on the Astro components) and an update never moves the camera, a basemap rebuild included.

  • getMap() returns the same map through document changes. Before, each new document made a new map, so a page read getMap() again after every ml-map:load. Now only a basemap change (mapStyle) builds a new map, and ml-map:load fires again when it does, so a page that refreshed its reference on ml-map:load keeps working. mapReady() resolves the current map, and waits for the new one during a rebuild.

  • ml-map:load fires once per map, not once per document. A page that listened for ml-map:load to re-read the document or re-sync its own controls after a document change now hears ml-map:update-applied for an in-place update; listen for both. (<FullPageMap>’s zoom and reset buttons do this.)

  • ml-map:state-change joins ml-map:parameter-change. The panel’s ml-map:parameter-change keeps firing per key, as before. The new ml-map:state-change fires once per write, from the panel or from setState(), with every current value and the keys that changed; a panel write fires one of each. New defaults in a changed document fire it too, except for keys a reader has written, which keep the reader’s value. (State and parameters)

  • Your own layers stay where they are. A layer you added through addLayer() or getMap().addLayer() is never moved or removed by an update, and keeps its absolute position in the stack. A paint or layout value you set on a document layer is overwritten only when the document’s own value for that property changed. A document source your layer still uses is left in place when the document drops it (and listed in summary.failures). To re-apply your own changes after an update, do it on ml-map:update-applied.

  • state: values survive a style change. Before, getMap().setStyle() (and the library’s own style loads) dropped the document’s state: values, so layers reading global-state fell back to the style’s own defaults. Now the values are reapplied after any style load. MapLibre’s setStyle() without transformStyle still removes the document’s layers, as it removes any runtime-added layer: change mapStyle in the document to change the basemap.

  • Astro: Map and FullPageMap take id and camera. id lands on the rendered <ml-map> so a page script can reach it (document.getElementById(id).update(doc)); camera="host" passes through. @maplibre-yaml/astro 0.8 needs @maplibre-yaml/core 0.10; upgrade both together, as in the Astro tab above. (Astro)

  • Hosting maplibre-yaml’s files yourself? There is one more chunk. The update engine is dist/chunks/update.js, downloaded on the first document change. A page that copied only the script keeps rendering, but its first update is refused (ml-map:update-rejected with kind: "chunk", and the notice names the file while you develop); copy the whole dist/ folder, as for the format readers in 0.9. (Hosting the files yourself) Refreshing and streaming sources (refreshInterval, stream:) load their code the same way, from dist/chunks/live.js, after the first data draws; a copy without it keeps the first data and shows one notice.

  • GeoParquet overview files read by view draw coarse levels. A file with geo:overviews levels (tylertoo writes them) read by view now draws the level that fits the zoom, where 0.9 drew only its full-detail level; with no minzoom of yours it is drawn from zoom 0. A file small enough to read whole is still read whole, at full detail. Reading levels is experimental: add overviews: false under load: to keep 0.9’s behaviour. (Overview files)

  • Computed class breaks work on GeoParquet read by view. A classify: with method: on such a source was refused; now its breaks come from one column of the full-detail rows, read once. FlatGeobuf and PMTiles sources read by view still refuse, and the notice prints the mlym breaks command whose breaks: line you paste instead. (Class breaks on large data)

  • MLT PMTiles archives draw without encoding: mlt on maplibre-gl 6 and later, which reads the tile type from the archive’s header; below 6, one note says the archive needs 6. An encoding: you write still wins. (MLT tiles)

  • A source key of the wrong type is reported at that key, such as sources.lots.load.maxFeatures, not at the source. A script that matched the error’s path for these errors sees the longer path.

  • update(doc) on <ml-map> applies a document and resolves with the outcome (applied, rejected, fallback or superseded) and the summary; getDocument() returns the document the map shows. (<ml-map> methods)
  • setState(values) and getState() read and write the document’s state: values; the params panel and setState are one state, each reflecting the other.
  • The camera attribute (document or host) names who owns the camera across document changes.
  • In React, the onml-map:update-applied, onml-map:update-rejected and onml-map:state-change props on React 19, and a useMlMap hook recipe that returns the map, the document and the state as React state (React).
  • On MapRenderer, update(next), getDocument(), setState, getState, the camera option and the update:applied, update:rejected and state:change events (JavaScript API).
  • JSON and TOML documents. Every place that reads a YAML document (<ml-map>, <ml-scrollytelling>, the Astro loaders, the CLI) reads JSON and TOML too, and mlym convert turns a document from one format into another, reporting anything that doesn’t carry over. (JSON and TOML)
  • A Large data guide: which format to use for which size, one command per route and the YAML to paste. The hints for a file too large or too dense link it and name the same command.
  • mlym prepare <file> reads a data file’s header or footer (a local path or an http(s) URL) and prints its facts, the one command that prepares it, and the source block to paste.
  • mlym breaks <file> computes class breaks over a whole GeoParquet, FlatGeobuf or GeoJSON file and prints a breaks: line for classify:.
  • load: { overviews: false } on a GeoParquet source, and encoding: mvt | mlt on a vector source, are documented schema keys.
  • For tools, readGeoParquetFacts and readFlatGeobufFacts read a file’s footer or header through any AsyncBuffer, and the command builders the hints use (overviewsCommand, pmtilesCommand and others) are exported.

See Troubleshooting. If a page that worked on 0.9 stops working on 0.10 and the notes above don’t explain it, please open an issue with the YAML, the page script and what you see.

0.9 adds thematic maps, large-data formats such as PMTiles and GeoParquet, and map titles, descriptions and translations.

@maplibre-yaml/core 0.9.1, @maplibre-yaml/astro 0.7.1, @maplibre-yaml/cli 0.6.1 and @maplibre-yaml/effects 0.1.2 are bug-fix releases. A page that loads core@0.9 from the CDN gets them with no change; in an npm project, npm update installs them.

  • A polled source always shows the latest data. A refresh: source asks the server on every tick; before, a poll faster than five minutes kept showing the first answer until the data cache expired. A cache: { enabled: false } added for that can go. (Live data)
  • updateStrategy: merge works on feeds that keep their id outside properties, such as the USGS feeds: updateKey: id matches the feature’s own id. Before, the first poll emptied the layer. (Merge)
  • hover.highlight works on GeoJSON loaded from url:, on named sources, and on FlatGeobuf and GeoParquet files, with no “needs feature ids” warning. (Respond to hover)
  • A layer whose source: names a source the document doesn’t define now fails validation at that line, with a “did you mean”; so does a $ref to a missing source. Before, the layer failed only on the page, so a document that validated on 0.9.0 can now report this: fix the name. (Sources & layers)
  • Keys that have no effect now warn in validation, a source’s loading: block among them. The document still validates, --strict included; you can delete the key. A stream: without a refresh: block also warns, because it never connects.
  • Pattern and icon images declared at a high pixelRatio no longer break up and crawl as the map moves.
  • Importing @maplibre-yaml/core/register during server-side rendering (Next.js, SvelteKit, Nuxt, Astro) no longer throws HTMLElement is not defined.
  • Astro: collection entries accept the GeoJSON shorthands (location:, route:, …) as map files do (Map documents as collection entries), and buildMultiPointMapConfig and buildRouteMapConfig apply their padding.
  • CLI: mlym preview follows preview.port, preview.open and preview.debug in the settings file; mlym emit --trust is deprecated and has no effect, so remove it from your scripts; mlym bake crosshatch writes textures that stay steady on a tilted map and no longer writes building-fallback.png; the mlym init -t astro project asks for Node.js 22.23.4 or later.
  • Effects: buildings no longer flicker with doubled outlines while you zoom across a tile level.

Your YAML keeps working. These are the changes you might see after upgrading, and what to do about each, if anything.

  • Hosting maplibre-yaml’s files yourself? Copy the whole dist/ folder. Some parts of maplibre-yaml now load on demand from dist/chunks/, next to the script: the readers for PMTiles, FlatGeobuf, GeoParquet and COG files and the Protomaps basemap. A page that copied only the script keeps working for every other map, but a map that needs a missing reader shows a notice naming the file. Loading from unpkg or jsDelivr needs no change. (Hosting the files yourself)
  • @maplibre-yaml/astro 0.7 needs @maplibre-yaml/core 0.9. Upgrade both together, as in the Astro tab above.
  • The legend’s header always reads “Legend”. On a plain map, a custom legend.title now appears as a heading inside the panel instead of replacing the header, matching story legends; a screen reader announces every legend the same way. No change to your YAML. CSS that styled .legend-title as your title should target .legend-heading. (Legend)
  • Author hints show only while you develop. The on-page notice keeps showing failures (a data file that didn’t load, a layer MapLibre rejected) everywhere, but hints meant for you (a “did you mean”, a key in the wrong place, coordinates that look written latitude-first) now show only on localhost, in a file:// page and under astro dev or vite, not on your published site. Add the debug attribute (or the debug prop on the Astro components) to see them on a deployed page; the console always has them. (When are author hints shown?)
  • Strings that start with = in a style value now warn. The format reserves them for a future shorthand: text-field: "=upper({name})" used to draw the text as written and now gets a warning suggesting a MapLibre expression. Text that really starts with = is written ["literal", "=…"]. (Strings starting with = are reserved)
  • A map without a basemap now warns in validation (mlym validate included). <ml-map> already refused such a map with an error card; the warning says so before you load the page. Add mapStyle: under config:.
  • Popup numbers follow the page’s language. A format: ",.0f" number used to be written in US English everywhere; on a page with <html lang="de"> it now reads 8.336.817. Name a locale in the format to fix one regardless of the page. (Format numbers)
  • bounds accepts both of MapLibre’s forms, four numbers [west, south, east, north] or two corners [[west, south], [east, north]] (the second used to fail). Values that validated before but broke the map, such as a latitude beyond ±90 or three numbers, are now validation errors with the expected order spelled out. (Fit to bounds)
  • fitTo on a url: source opens already framed on the data, with no jump from center/zoom. While the file loads, the map waits up to 1.5 seconds before its first paint; on a slow file it then draws at center/zoom and frames the data when it arrives, as before. (Fit to a source’s data)
  • fitTo keeps a margin around the data. Without padding:, the data is framed with a margin (8% of the map’s shorter side, 12 to 48 pixels, plus room for the attribution at the bottom), so circles and icons at its edges are drawn whole instead of cut in half. Write padding: 0 for the exact extent, as 0.8 framed it, or any padding: of your own. (Fit to a source’s data)
  • A layer’s own legend entry shows a legend. A layer with legend: { label, color } used to appear only when the document also had a legend: block; now the map shows a legend for it anyway, as it does for a classified layer. Write legend: false at the top level to keep a map without one. (Legend)
  • mlym emit writes a GeoJSON url: source as data: <url>, the way the MapLibre style spec expects, so the exported style.json now loads in MapLibre. A live url: source (refresh:, stream:) is reported as a contract warning instead of lossy. (emit)
  • A slow map says it is loading. If a map hasn’t drawn after about a second, a small “Loading map…” appears in its middle until the basemap draws. A page with its own loading indicator hides it with ml-map .ml-map-loading { display: none; }.
  • A layer whose before: names a layer the map doesn’t have is drawn on top instead of disappearing (MapLibre used to refuse it). While you develop, the author notes suggest the closest layer id.
  • The CDN script is larger: about 175 KB gzip, up from about 125 KB, for thematic maps, translations, number formatting and the large-data formats. The format readers themselves are separate files, downloaded only by maps that use them.
  • Thematic maps. A layer’s classify: block makes a choropleth, graduated symbols or a category map from your data, with a legend generated for it: explicit breaks or quantile, equal-interval and Jenks classes, named colour palettes, rates with normalize:, and a colour for missing values. See Thematic maps & legends and the thematic maps example.
  • Large data from YAML alone. PMTiles, FlatGeobuf, GeoParquet and Cloud Optimized GeoTIFF (COG) files, read in parts straight from a static host such as GitHub Pages, and a whole basemap from one Protomaps .pmtiles file with no API key (mapStyle: data/city.pmtiles is enough). See Large data: PMTiles, FlatGeobuf, GeoParquet & COG.
  • Accessible, translated maps. A document’s title: and description: name and describe the map for screen readers; locale: translates every piece of text the library puts on the map; popup numbers use Intl.NumberFormat options. See Accessibility & languages.
  • Smaller conveniences:
    • fitTo: tracts, the source name alone, as shorthand for fitTo: { source: tracts }.
    • legend: false on a layer keeps it out of the legend.
    • The debug attribute on <ml-map> and <ml-scrollytelling> (and the debug prop on the Astro components) shows author hints on a published page.
    • On a narrow map, a legend and a layer panel in two corners of the same edge no longer overlap, and a story’s pinned legend no longer covers the map’s notice.
    • mlym validate prints notes (ℹ note) that explain how a valid value is read, such as a basemap written as a .pmtiles file alone. Notes are not warnings: the file still reads ✓ valid, and --strict never fails on them.
    • mlym init --template basic and --template story load core at the release line the CLI was built with, so a new project gets the features these docs describe.

See Troubleshooting. If a map that worked on 0.8 stops working on 0.9 and the notes above don’t explain it, please open an issue with the YAML and what you see.

Moving a project from an older line, such as 0.5, straight to 0.10? Read the notes for each line you skip, oldest first.

0.8 added the on-map notice for a layer or file that didn’t load, the base attribute for sites under a subpath, and story maps in plain HTML (<ml-scrollytelling>). What changes for an existing project:

  • In Astro, a relative path in a document means “from public/”. @maplibre-yaml/astro 0.6 passes the site’s base to the map, so data/x.geojson loads public/data/x.geojson on every page. Before, it resolved against the page, so on a nested page such as /blog/post/ it asked for /blog/post/data/x.geojson. Paths that start with / and full URLs behave as before. base={false} on a component restores the old resolution for that map.
  • The CLI needs Node.js 20.9 or later (@maplibre-yaml/cli 0.5).
  • Colour names are checked. circle-color: "bleu" used to validate and then drop the layer on the page; it is now a validation error with a “did you mean”.
  • Two chapters with the same id are an error, naming both lines. Two layers with the same id warn: the first is drawn and the repeat skipped.
  • Keys nested one level too deep under config: warn (for example legend: or controls:, which belong at the top level), with the line number, instead of being ignored.

0.7 added maplibre-gl 6 support, markers:, images:, hover popups and 3D terrain, sky and globe. What changes for an existing project:

  • Install maplibre-gl yourself. It is a peer dependency of @maplibre-yaml/core, no longer installed with it: npm install @maplibre-yaml/core maplibre-gl@^6.
  • maplibre-gl 6 in a bundler needs its worker set, or every map fails with Worker failed to load (Using a bundler (Vite)). On a CDN page, point the import map at maplibre-gl@6/dist/maplibre-gl.mjs and the stylesheet at maplibre-gl@6 too. The Astro components set the worker themselves.

Three behaviour changes matter when you move to 0.6:

  • !html in popups is trust-gated, not unconditional. A popup !html value renders as raw markup only under a trusted capability policy; otherwise it is escaped and shown as text. <ml-map> is untrusted by default, so there !html content is escaped. In Astro, loadYAML and loadFromGlob now parse with core’s own options, so an !html tag reaches the map as the same { $html } value core produces (before, the Astro loader silently turned it into a plain string); it then renders under the same trust rule.
  • Malformed inline GeoJSON now warns. A v1 document whose inline GeoJSON data is malformed gets a warning, which mlym validate --strict and CI runs treat as an error. Check inline geometry before upgrading.
  • Format v2 style.metadata carries through. In a v2 document, style.metadata is copied to the root metadata of the emitted style.json.

With @maplibre-yaml/core 0.6.0 or earlier, every @maplibre-yaml/astro component fails under astro dev with Failed to create map: Map is not a constructor, while astro build works: Vite never pre-bundles maplibre-gl when only a dependency’s .astro file imports it. Current releases are not affected; upgrade core and the Astro package together (How to upgrade). If a project must stay on core 0.6.0, tell Vite to pre-bundle maplibre-gl:

astro.config.mjs
import { defineConfig } from "astro/config";
export default defineConfig({
vite: { optimizeDeps: { include: ["maplibre-gl"] } },
});