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.
How to upgrade
Section titled “How to upgrade”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.
Before 1.0, a range such as ^0.9.1 in package.json stays within 0.9.x,
so npm install never moves it to 0.10 by itself. Ask for the latest release:
npm install @maplibre-yaml/core@latestpackage.json then reads "@maplibre-yaml/core": "^0.10.0" (or later).
Upgrade core and the Astro package together (@maplibre-yaml/astro 0.8
requires @maplibre-yaml/core 0.10 or later):
npm install @maplibre-yaml/core@latest @maplibre-yaml/astro@latestpackage.json then reads "@maplibre-yaml/core": "^0.10.0" and
"@maplibre-yaml/astro": "^0.8.0" (or later). Restart astro dev
afterwards.
With npx maplibre-yaml@latest … there is nothing installed to upgrade:
the @latest makes npx fetch the newest CLI instead of reusing an older
copy it downloaded before. A CLI installed in a project or globally moves with:
npm install --save-dev @maplibre-yaml/cli@latest # in a project: ^0.6.0npm install -g @maplibre-yaml/cli@latest # installed globallyAn installed CLI also answers to its short name, mlym, which the notes
below use: mlym validate is npx maplibre-yaml@latest validate.
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.
What behaves differently
Section titled “What behaves differently”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-appliedfires with a summary of what changed; an invalid document is refused withml-map:update-rejectedand the map kept, where before the error card replaced it. Only a changedmapStylestill 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
centerandzoombecause the map was rebuilt. Now the camera moves only when the document’scenter,zoom,bearing,pitchorfitTochanged; 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 onml-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 (thecameraprop 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 readgetMap()again after everyml-map:load. Now only a basemap change (mapStyle) builds a new map, andml-map:loadfires again when it does, so a page that refreshed its reference onml-map:loadkeeps working.mapReady()resolves the current map, and waits for the new one during a rebuild. -
ml-map:loadfires once per map, not once per document. A page that listened forml-map:loadto re-read the document or re-sync its own controls after a document change now hearsml-map:update-appliedfor an in-place update; listen for both. (<FullPageMap>’s zoom and reset buttons do this.) -
ml-map:state-changejoinsml-map:parameter-change. The panel’sml-map:parameter-changekeeps firing per key, as before. The newml-map:state-changefires once per write, from the panel or fromsetState(), 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()orgetMap().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 insummary.failures). To re-apply your own changes after an update, do it onml-map:update-applied. -
state:values survive a style change. Before,getMap().setStyle()(and the library’s own style loads) dropped the document’sstate:values, so layers readingglobal-statefell back to the style’s own defaults. Now the values are reapplied after any style load. MapLibre’ssetStyle()withouttransformStylestill removes the document’s layers, as it removes any runtime-added layer: changemapStylein the document to change the basemap. -
Astro:
MapandFullPageMaptakeidandcamera.idlands on the rendered<ml-map>so a page script can reach it (document.getElementById(id).update(doc));camera="host"passes through.@maplibre-yaml/astro0.8 needs@maplibre-yaml/core0.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-rejectedwithkind: "chunk", and the notice names the file while you develop); copy the wholedist/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, fromdist/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:overviewslevels (tylertoo writes them) read by view now draws the level that fits the zoom, where 0.9 drew only its full-detail level; with nominzoomof 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: addoverviews: falseunderload:to keep 0.9’s behaviour. (Overview files) -
Computed class breaks work on GeoParquet read by view. A
classify:withmethod: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 themlym breakscommand whosebreaks:line you paste instead. (Class breaks on large data) -
MLT PMTiles archives draw without
encoding: mlton maplibre-gl 6 and later, which reads the tile type from the archive’s header; below 6, one note says the archive needs 6. Anencoding: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’spathfor these errors sees the longer path.
What’s new in 0.10
Section titled “What’s new in 0.10”update(doc)on<ml-map>applies a document and resolves with the outcome (applied,rejected,fallbackorsuperseded) and the summary;getDocument()returns the document the map shows. (<ml-map>methods)setState(values)andgetState()read and write the document’sstate:values; the params panel andsetStateare one state, each reflecting the other.- The
cameraattribute (documentorhost) names who owns the camera across document changes. - In React, the
onml-map:update-applied,onml-map:update-rejectedandonml-map:state-changeprops on React 19, and auseMlMaphook recipe that returns the map, the document and the state as React state (React). - On
MapRenderer,update(next),getDocument(),setState,getState, thecameraoption and theupdate:applied,update:rejectedandstate:changeevents (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, andmlym convertturns 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 anhttp(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 abreaks:line forclassify:.load: { overviews: false }on a GeoParquet source, andencoding: mvt | mlton a vector source, are documented schema keys.- For tools,
readGeoParquetFactsandreadFlatGeobufFactsread a file’s footer or header through anyAsyncBuffer, and the command builders the hints use (overviewsCommand,pmtilesCommandand others) are exported.
Something broke?
Section titled “Something broke?”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.
Fixed in 0.9.1
Section titled “Fixed in 0.9.1”@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. Acache: { enabled: false }added for that can go. (Live data) updateStrategy: mergeworks on feeds that keep their id outsideproperties, such as the USGS feeds:updateKey: idmatches the feature’s ownid. Before, the first poll emptied the layer. (Merge)hover.highlightworks on GeoJSON loaded fromurl:, 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$refto 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,--strictincluded; you can delete the key. Astream:without arefresh:block also warns, because it never connects. - Pattern and icon images declared at a high
pixelRationo longer break up and crawl as the map moves. - Importing
@maplibre-yaml/core/registerduring server-side rendering (Next.js, SvelteKit, Nuxt, Astro) no longer throwsHTMLElement is not defined. - Astro: collection entries accept the GeoJSON shorthands (
location:,route:, …) as map files do (Map documents as collection entries), andbuildMultiPointMapConfigandbuildRouteMapConfigapply theirpadding. - CLI:
mlym previewfollowspreview.port,preview.openandpreview.debugin the settings file;mlym emit --trustis deprecated and has no effect, so remove it from your scripts;mlym bake crosshatchwrites textures that stay steady on a tilted map and no longer writesbuilding-fallback.png; themlym init -t astroproject asks for Node.js 22.23.4 or later. - Effects: buildings no longer flicker with doubled outlines while you zoom across a tile level.
What behaves differently
Section titled “What behaves differently”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 fromdist/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/astro0.7 needs@maplibre-yaml/core0.9. Upgrade both together, as in the Astro tab above.- The legend’s header always reads “Legend”. On a plain map, a custom
legend.titlenow 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-titleas 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 afile://page and underastro devorvite, not on your published site. Add thedebugattribute (or thedebugprop 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 validateincluded).<ml-map>already refused such a map with an error card; the warning says so before you load the page. AddmapStyle:underconfig:. - 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 reads8.336.817. Name alocalein the format to fix one regardless of the page. (Format numbers) boundsaccepts 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)fitToon aurl:source opens already framed on the data, with no jump fromcenter/zoom. While the file loads, the map waits up to 1.5 seconds before its first paint; on a slow file it then draws atcenter/zoomand frames the data when it arrives, as before. (Fit to a source’s data)fitTokeeps a margin around the data. Withoutpadding:, 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. Writepadding: 0for the exact extent, as 0.8 framed it, or anypadding: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 alegend:block; now the map shows a legend for it anyway, as it does for a classified layer. Writelegend: falseat the top level to keep a map without one. (Legend) mlym emitwrites a GeoJSONurl:source asdata: <url>, the way the MapLibre style spec expects, so the exportedstyle.jsonnow loads in MapLibre. A liveurl:source (refresh:,stream:) is reported as acontractwarning instead oflossy. (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.
What’s new in 0.9
Section titled “What’s new in 0.9”- 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 withnormalize:, 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
.pmtilesfile with no API key (mapStyle: data/city.pmtilesis enough). See Large data: PMTiles, FlatGeobuf, GeoParquet & COG. - Accessible, translated maps. A document’s
title:anddescription:name and describe the map for screen readers;locale:translates every piece of text the library puts on the map; popup numbers useIntl.NumberFormatoptions. See Accessibility & languages. - Smaller conveniences:
fitTo: tracts, the source name alone, as shorthand forfitTo: { source: tracts }.legend: falseon a layer keeps it out of the legend.- The
debugattribute on<ml-map>and<ml-scrollytelling>(and thedebugprop 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 validateprints notes (ℹ note) that explain how a valid value is read, such as a basemap written as a.pmtilesfile alone. Notes are not warnings: the file still reads✓ valid, and--strictnever fails on them.mlym init --template basicand--template storyload core at the release line the CLI was built with, so a new project gets the features these docs describe.
Something broke?
Section titled “Something broke?”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.
Older releases
Section titled “Older releases”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.
Upgrading to 0.8
Section titled “Upgrading to 0.8”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/astro0.6 passes the site’s base to the map, sodata/x.geojsonloadspublic/data/x.geojsonon 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/cli0.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
idare an error, naming both lines. Two layers with the sameidwarn: the first is drawn and the repeat skipped. - Keys nested one level too deep under
config:warn (for examplelegend:orcontrols:, which belong at the top level), with the line number, instead of being ignored.
Upgrading to 0.7
Section titled “Upgrading to 0.7”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.mjsand the stylesheet atmaplibre-gl@6too. The Astro components set the worker themselves.
Upgrading to 0.6
Section titled “Upgrading to 0.6”Three behaviour changes matter when you move to 0.6:
!htmlin popups is trust-gated, not unconditional. A popup!htmlvalue 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!htmlcontent is escaped. In Astro,loadYAMLandloadFromGlobnow parse with core’s own options, so an!htmltag 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
datais malformed gets a warning, whichmlym validate --strictand CI runs treat as an error. Check inline geometry before upgrading. - Format v2
style.metadatacarries through. In a v2 document,style.metadatais copied to the rootmetadataof the emittedstyle.json.
Astro with core 0.6.0 or earlier
Section titled “Astro with core 0.6.0 or earlier”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:
import { defineConfig } from "astro/config";
export default defineConfig({ vite: { optimizeDeps: { include: ["maplibre-gl"] } },});