Export classes
When you export a map document with mlym emit, each part
of it either goes into the style.json, goes in as an approximation, or is
left out. This page lists which, for every part of the format. You need it
when an export prints a warning or --strict refuses one, or when you plan
a map that must export without losses.
Reading the report
Section titled “Reading the report”mlym emit prints a warning on stderr for every part that doesn’t export
exactly. Each names the part’s path in the document:
WARN layers.quakes.interactive: interactive — Interactions (popups, hover, highlight) are runtime behavior with no style.json form; the emitted style renders the layer without them. attachInteractions() restores them over an exported style.
WARN controls: controls — Controls are DOM chrome; the emitted style renders the map with MapLibre's default control set only.A warning is one of two kinds:
-
contract: an expected, documented drop or requirement. The exported map looks the same; something around it is missing (popups, controls), or the page showing it must do something (register thepmtiles://protocol).--strictallows these. -
lossy: what the map shows changed, for example markers drawn as a symbol layer, or a source with no data at export time.--strictrefuses the export and lists each one:ERROR Export failed in strict mode: 1 item(s) could not be exported to style.json without changing what the map shows.ERROR markers: markers cannot compile without visual change. …
The three classes
Section titled “The three classes”| Class | What mlym emit does |
|---|---|
exports | Writes it to style.json as it is, or in an equivalent style form. |
exports-with-fallback | Writes an approximation, such as a marker drawn as a symbol layer with a pin image, and a lossy warning when the map looks different. |
no-export | Leaves it out, with a contract warning naming it. It is never dropped silently. |
Every part, by class
Section titled “Every part, by class”Grouped by class: first what exports, then what exports with a fallback, then what doesn’t export.
| Part | Class | On export |
|---|---|---|
center / zoom / pitch / bearing | exports | The style’s camera. |
state | exports | The style’s state. Below the maplibre-gl version that reads it (--target), its defaults are written into the expressions instead. |
layer.before | exports | The layer’s position in the layers list. |
layer.classify | exports | Plain paint expressions (step or match) and a filter for hidden classes. Computed breaks are worked out from the data at export; mlym emit fetches a url: source for that, and fails, naming the layer and URL, when it can’t. See Thematic maps. |
images | exports | Fetched and added to the style’s sprite; layers refer to them as mlym:<name>. |
terrain / sky / light / projection | exports | The style’s own properties, replacing the basemap’s. A terrain source that isn’t a raster-dem source is dropped (lossy). sky and globe projection are lossy against a --target below maplibre-gl 4.5 and 5.0. |
color-relief layers | exports | The layer as written. lossy against a --target below maplibre-gl 5.6. |
title / description | exports | The style’s name, and maplibre-yaml:description in its metadata. See Accessibility & languages. |
format.pmtiles | exports | A pmtiles:// URL. A contract warning: the page must register the PMTiles protocol. |
format.cog | exports | A cog:// URL in the form the map uses (#dem on elevation, a colorRamp: as #color:). A contract warning: the page must register the COG protocol. See COG. |
source.format / source.colorRamp | exports | Carried by the exported source’s URL or data; the keys themselves are not in the style. |
markers | exports-with-fallback | A symbol layer with generated pin images (--sprite-base needed). Dragging and marker popups don’t export (lossy). |
fitTo | exports-with-fallback | A fixed camera: computed from the data when the source is inline, for a 1024×768 view (lossy, since a live map fits its own size). For a fetched or tiled source the written center and zoom stand in (lossy). |
layer.effect | exports-with-fallback | Experimental. The layer’s own static style, with one lossy warning per effect. See Effects. |
format.flatgeobuf / format.geoparquet | exports-with-fallback | The file’s features as inline GeoJSON, read at export (for GeoParquet, every column or the columns: listed). A file that can’t be read exports empty (lossy). |
layer.interactive | no-export | Popups, hover and highlight are behaviour. attachInteractions puts them back. |
layer.legend / layer.label / layer.toggleable | no-export | Legend entries and the layer panel are page furniture; the layer exports with its written visibility. |
source.refresh / source.stream / source.cache / source.loading / source.prefetchedData / source.fetchStrategy / source.refreshInterval / source.updateStrategy / source.updateKey | no-export | Live data. The exported source has the data present at export: inline data, or a GeoJSON url: written as data: <url>, loaded once. With neither, it is lossy. |
source.grid | no-export | A grid source is not a MapLibre source, so it is left out of sources; its declaration is kept under metadata["maplibre-yaml:grid-sources"], keyed by id, for maplibre-yaml renderers. A contract warning, so --strict passes. No layer type draws a grid; a layer over one is dropped (lossy). See Grid sources. |
source.load / source.columns | no-export | How the browser reads a FlatGeobuf or GeoParquet file; the exported source already holds its features. |
map.options | no-export | MapLibre Map options are the page’s choice; the exported style uses MapLibre’s defaults. |
controls | no-export | The exported map gets MapLibre’s default controls only. |
legend / popups / container | no-export | Page furniture around the map. |
parameters | no-export | Labels for state keys; the values export through state. |
x-* | no-export | Extension blocks, read by the page, not the map. |
The basemap
Section titled “The basemap”The basemap isn’t a part of its own: mlym emit merges it into the style.
A style URL is fetched and written in, and a
Protomaps basemap
(mapStyle: data/nyc.pmtiles or { pmtiles: … }) is written as the full
style it generates, its file as a pmtiles:// URL that the page must
register.
<ml-map> slots are page markup, not part
of the document, so they don’t appear here: an export never sees them.