Map export format
A map directory describes worldspace maps for a consumer such as the generated site. It holds an
index, maps.json, and one manifest per map. A manifest describes its map completely, load order
included, so an index can list maps of several runs and several load orders.
export:worldspace-maps:lod and export:worldspace-maps:raster-records write this format with
--format grid and --format pmtiles. --format plain-png writes no manifest and no index. You
can also write an index by hand, see Writing an index by hand.
The authoritative C# shapes are in Pipelines/Maps/Output/MapManifest.cs (MapIndex,
MapManifest and its parts) and Pipelines/Maps/Output/MapGridManifest.cs (MapGridMarkerGroup,
MapGridMarker). The TypeScript below mirrors them for consumers outside the exporter; keep
both in sync by hand. Both files are written with System.Text.Json source generation
(MapContractJsonContext), camelCase, indented, accented names unescaped.
Files
<map-directory>/
maps.json the index
<manifest path> one per map, any name, any subfolder
<tiles path> a grid folder <z>/<x>/<y>.png, or a .pmtiles archive
<level tiles path> one per level past level 0, of the same type
| Rule | Detail |
|---|---|
| Paths are relative | To the file that holds them: an index entry’s manifest to maps.json, a manifest’s tiles.path and each level’s to the manifest |
| Separator | / only. A path holding \ breaks the rule |
| Inside the directory | No .. segment, no empty segment, not rooted (/abs, C:/abs) |
| Null, not left out | An optional field is written as null, so a hand-written manifest and a generated one read the same way |
The grid’s tiles.json and the PMTiles metadata are not part of the format: they are the tile
viewers’ own manifests, see Grid output. They
leave a null field out.
Index: maps.json
/** Which maps exist. Nothing else. */
interface MapIndex {
maps: MapIndexEntry[];
}
interface MapIndexEntry {
/** The worldspace's EditorID. Unique in the index, case-insensitive: the site's URLs use it. */
editorId: string;
/** Path of the map's manifest (a MapManifest), relative to maps.json. */
manifest: string;
}
Manifest
/** One map, described completely. */
interface MapManifest {
/** Must equal the index entry's editorId. */
editorId: string;
/** "owningPlugin:localId", e.g. "skyrim.esm:00003C". */
formId: string;
/** WRLD FULL in `language`; null without one or when its string id is missing. */
name: string | null;
/** WRLD WNAM's EditorID; null without a parent or when it doesn't resolve. */
parentEditorId: string | null;
/** WRLD DATA flags. */
flags: { smallWorld: boolean; cantFastTravel: boolean };
/** The image's size in cells, and the LAND cells drawn. */
cells: { width: number; height: number; land: number };
tiles: MapTiles;
/** The full-size image: tile pixels at maxZoom. */
image: {
width: number;
height: number;
pixelsPerCell: number;
/** The image's edges in game units, X east, Y north. */
worldBounds: { west: number; north: number; east: number; south: number };
};
/** How the image was made, for display only: labels chosen by the producer. */
render: { background: string; layers: string[] };
/** The language of `name` and of the markers' names, e.g. "english". */
language: string;
/** The files the map was made from. Same shape as export.json's loadOrder. */
loadOrder: LoadOrder;
/** The plugins carrying the worldspace's WRLD or one of its CELL records, in load order. */
plugins: MapPlugin[];
/** What `--markers` lists, one group per kind. Null when the map was made without it. */
markerGroups: MarkerGroup[] | null;
/** The levels drawn over level 0 (`tiles`), in slider order. Null for a map of one level. */
levels: MapLevel[] | null;
/** The command and options the map was made with, see the book export format's ExportMeta.
* Optional: an older manifest or one written by hand has none. */
meta?: ExportMeta;
}
interface MapTiles {
type: "grid" | "pmtiles";
/** A grid folder holding <z>/<x>/<y>.png, or a .pmtiles file; relative to the manifest. */
path: string;
tileSize: number;
minZoom: number;
maxZoom: number;
}
interface MapLevel {
/** 1, 2, ... from the top level down. Level 0 is the manifest's `tiles`. */
index: number;
/** The level's stop in game units; null for a level that is not an altitude. */
altitude: number | null;
/** For display, e.g. "z 272". */
label: string;
/** Only the tiles that differ from level 0's. Same type, tileSize, minZoom and maxZoom as `tiles`. */
tiles: MapTiles;
}
interface LoadOrder {
name: string;
plugins: string[];
archives: string[];
}
interface MapPlugin {
/** File name, as in loadOrder.plugins. */
plugin: string;
/** "defines": owns the WRLD FormId. "overrides": carries a later version. null: no WRLD. */
worldspace: "defines" | "overrides" | null;
/** CELL records of the worldspace whose FormId the plugin owns. */
newCells: number;
/** CELL records of the worldspace whose FormId another plugin owns. */
overriddenCells: number;
}
interface MarkerGroup {
/** The kind, as `--markers` names it: unique in the map. */
id: string;
/** The label of the group's layer. */
name: string;
/** CSS "#rrggbb". */
color: string;
/** Whether a viewer shows the layer when the map opens. */
defaultVisible: boolean;
markers: Marker[];
}
interface Marker {
/** The record the marker stands for. */
formId: string;
name: string | null;
/** The game starts without it: a viewer draws it fainter. */
disabled: boolean;
worldspace: string | null;
x: number; y: number; z: number;
/** Pixels from the image's top-left corner at full size. */
pixelX: number; pixelY: number;
/** The first and last level showing the marker's floor; null for a map of one level. */
levels: { from: number; to: number } | null;
/** Display label and text pairs, listed as they are. The keys depend on the group. */
data: Record<string, string>;
}
A pixel at full size spans (east - west) / width game units. With Leaflet, use CRS.Simple and
maxNativeZoom set to maxZoom.
Marker groups
What the exporter reads to fill these groups is described in Markers.
A viewer needs no knowledge of what a group holds: it makes one layer per group from its name
and color, shows it when defaultVisible is true, and draws each marker at its pixel. A
disabled marker is drawn fainter. The popup lists formId, the pairs of data in their order
and the game position.
| Marker property | Meaning |
|---|---|
formId | The record the marker stands for: the REFR of a location marker, the BOOK of a books marker |
name | FULL; null without one, or when its string id is missing from the tables |
disabled | The REFR’s “Initially Disabled” header flag |
worldspace | The EditorID of the marker’s worldspace |
x, y, z | Game units in the marker’s worldspace, from DATA, to the hundredth |
pixelX, pixelY | Pixels from the image’s top-left corner, at full size, to the hundredth |
levels | The levels whose floor under the marker is the floor nearest its z |
data | Text pairs; the keys are display labels |
The groups the exporter writes:
Group id | name | color | defaultVisible | data keys |
|---|---|---|---|---|
location | location | #f5c542 | true | Type (the spec’s name, or the number past the enum), then Visible and Can travel to, always set to yes or no |
books | Books | #b07cf0 | false | none: data is {} |
A book is listed once per REFR, so a book lying in several places appears several times. Its
content, image and page are not part of the list.
markerGroups: [] is a map made with --markers and no group; a group with markers: [] means
none of its kind falls on the image; null means the map was made without --markers.
A marker’s levels is null when the map’s levels is.
Map levels
A map with levels is a stack: level 0 is tiles, and each level is a layer of tiles drawn over
it. A level holds only the tiles whose pixels differ from level 0’s at the same z/x/y, at every
zoom. Where a level has no tile, level 0 shows through and is right there. What the levels show is
described in Levels.
| Level property | Meaning |
|---|---|
index | 1 for the top level under level 0, then down. In levels in index order |
altitude | The level’s stop, in game units: level k shows, under each point, the highest floor less than 64 units above it, else the lowest. A whole number |
label | z <altitude>, without decimals |
tiles | As the map’s tiles, with its own path |
A marker’s levels gives the levels whose floor under the marker is the floor nearest its z,
first and last: a marker on an upper floor shows on the levels that keep that floor, one on the
floor under it on the levels that show it. Where the levels don’t cut the map, or for a marker of
a descendant worldspace that its ONAM moves or scales, levels spans every level, from 0 to the
last index.
Consumer rules
| Situation | Consumer does |
|---|---|
maps.json missing or not a MapIndex | Fails |
Index entry without editorId or manifest | Skips the entry |
Duplicate editorId in the index (case-insensitive) | Keeps the first |
Manifest missing, unreadable, or editorId differs from the entry | Skips the map |
Manifest without tiles, or without image.worldBounds | Skips the map |
Path with .., absolute, or a \ | Skips the map |
tiles.type unknown, or tiles.path missing on disk | Skips the map |
tiles.type and the file disagree: a grid path that isn’t a folder holding at least one file, a pmtiles path that isn’t a file | Skips the map |
parentEditorId not in the index | Shows the map as a root |
A level whose tiles.type, tileSize, minZoom or maxZoom differs from tiles | Drops the level |
A level whose tiles.path breaks a path rule or is missing on disk | Drops the level, keeps the map |
A level without label or tiles, or whose index is under 1 | Drops the level |
Two levels with the same index | Keeps the first one it can use |
levels out of index order | Reads them in index order |
levels: [], or every level dropped | Reads it as null |
What the exporter writes
Each tile map gets <EditorID>.json next to its tiles: the grid’s Tamriel/ gets
Tamriel.json, Tamriel.pmtiles gets Tamriel.json. At the end of the run, maps.json lists the
maps this run wrote, replacing any earlier one. A run that writes no map writes no index. These
names are the exporter’s defaults, not rules of the format.
| Manifest field | Source |
|---|---|
editorId, formId, parentEditorId, flags | The merged WRLD |
name | WRLD FULL, resolved in --language against the string tables of the plugin that wrote the last FULL, even without --markers |
cells | width, height: the image divided by pixelsPerCell. land: the LAND cells drawn |
tiles, image | The numbers of tiles.json |
render.background | lod or raster-records |
render.layers | Display labels of what was drawn: the background’s options (terrain colormap, hillshade, grass), then the layers in their drawing order (objects (texture), water, roads, light tint, lights, cell-grid), then the id of each kind of --markers (location, books) |
language, markerGroups | --language; the groups as in tiles.json with --markers, null without |
levels | With --levels, the level files the run wrote, <EditorID>.level-<k> or <EditorID>.level-<k>.pmtiles; null without --levels or for a map without stops |
loadOrder | The plugins read and the archives opened, as export.json of export:books |
plugins | Each plugin of the load order carrying the worldspace’s WRLD or one of its CELL records, the persistent cell included, see the assumption |
meta | The command and its options, see Export meta. The same in every manifest of a run |
A mod that places objects in a worldspace carries the cells it places them in, so it shows in
plugins even when it doesn’t touch the WRLD. With --parent-lod, plugins lists the
worldspace’s own plugins, not its parent’s.
Writing an index by hand
To show maps of several runs together, put each run in its own subfolder and write a maps.json
at the top that points at their manifests:
{
"maps": [
{ "editorId": "Tamriel", "manifest": "vanilla/Tamriel.json" },
{ "editorId": "Sovngarde", "manifest": "modded/Sovngarde.json" }
]
}
Each manifest keeps its own load order, and its tiles.path stays relative to the manifest.