applyDocumentBase
applyDocumentBase(
model,base):MapModel
Defined in: packages/core/src/utils/document-base.ts:336
Resolve every URL in a normalized map document against base.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
model | MapModel | The document as toModel returns it (v1 and v2 both normalize to this shape). |
base | string | null | undefined | The document base (any form normalizeDocumentBase accepts). Without one the model is returned as is. |
Returns
Section titled “Returns”A model whose URL fields are resolved — the input when nothing changed. Never mutates the input, and never adds a key.
Remarks
Section titled “Remarks”The fields, from the schemas:
| Where | Field |
|---|---|
config.mapStyle / style.basemap | the style URL; for an inline style object, its sprite, glyphs and sources; for a Protomaps basemap, its pmtiles, glyphs and sprite |
sources.* and inline layers[].source | url, tiles[], urls[] (video), data when it is a string, stream.url |
images.* | the URL string, or url |
markers[] | icon, and hrefs in its popup |
layers[].interactive | hrefs in hover.popup / click.popup |
popups[] | hrefs in content |
Not URLs, so not touched: legend icon (rendered as text), popup image
src (absolute URLs only), fitTo.source / terrain.source (source
names), and anything inside an external style JSON or GeoJSON file.