Skip to content

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.

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 the pmtiles:// protocol). --strict allows these.

  • lossy: what the map shows changed, for example markers drawn as a symbol layer, or a source with no data at export time. --strict refuses 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. …
ClassWhat mlym emit does
exportsWrites it to style.json as it is, or in an equivalent style form.
exports-with-fallbackWrites 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-exportLeaves it out, with a contract warning naming it. It is never dropped silently.

Grouped by class: first what exports, then what exports with a fallback, then what doesn’t export.

PartClassOn export
center / zoom / pitch / bearingexportsThe style’s camera.
stateexportsThe style’s state. Below the maplibre-gl version that reads it (--target), its defaults are written into the expressions instead.
layer.beforeexportsThe layer’s position in the layers list.
layer.classifyexportsPlain 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.
imagesexportsFetched and added to the style’s sprite; layers refer to them as mlym:<name>.
terrain / sky / light / projectionexportsThe 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 layersexportsThe layer as written. lossy against a --target below maplibre-gl 5.6.
title / descriptionexportsThe style’s name, and maplibre-yaml:description in its metadata. See Accessibility & languages.
format.pmtilesexportsA pmtiles:// URL. A contract warning: the page must register the PMTiles protocol.
format.cogexportsA 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.colorRampexportsCarried by the exported source’s URL or data; the keys themselves are not in the style.
markersexports-with-fallbackA symbol layer with generated pin images (--sprite-base needed). Dragging and marker popups don’t export (lossy).
fitToexports-with-fallbackA 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.effectexports-with-fallbackExperimental. The layer’s own static style, with one lossy warning per effect. See Effects.
format.flatgeobuf / format.geoparquetexports-with-fallbackThe 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.interactiveno-exportPopups, hover and highlight are behaviour. attachInteractions puts them back.
layer.legend / layer.label / layer.toggleableno-exportLegend 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.updateKeyno-exportLive 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.gridno-exportA 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.columnsno-exportHow the browser reads a FlatGeobuf or GeoParquet file; the exported source already holds its features.
map.optionsno-exportMapLibre Map options are the page’s choice; the exported style uses MapLibre’s defaults.
controlsno-exportThe exported map gets MapLibre’s default controls only.
legend / popups / containerno-exportPage furniture around the map.
parametersno-exportLabels for state keys; the values export through state.
x-*no-exportExtension blocks, read by the page, not the map.

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.