Expands a {s} subdomain URL template into an array of
explicit tile URLs suitable for MapLibre raster sources.
Rules:
If definition.tiles is a non-empty array → returned as-is (highest priority),
then {apikey} placeholders are resolved using definition.apiKey.
If definition.url starts with pmtiles:// → returned as single-element array (no expansion).
If definition.url contains {s} → expanded using definition.subdomains
(string "abc" or array ["a","b","c"]; defaults to ["a","b","c"]).
If definition.url is present without {s} → returned as single-element array.
Otherwise → empty array.
API key injection:
If any resolved URL contains {apikey} and definition.apiKey is provided,
{apikey} is replaced with the key value for all URLs.
If apiKey is absent and definition.apiKeyRequired is true,
a warning is emitted and an empty array is returned (basemap disabled).
If apiKey is absent and apiKeyRequired is not set (optional key, e.g. Stadia),
the {apikey} placeholder and its query param are stripped — the URL remains valid
for unauthenticated access.
Expands a
{s}subdomain URL template into an array of explicit tile URLs suitable for MapLibre raster sources.Rules:
definition.tilesis a non-empty array → returned as-is (highest priority), then{apikey}placeholders are resolved usingdefinition.apiKey.definition.urlstarts withpmtiles://→ returned as single-element array (no expansion).definition.urlcontains{s}→ expanded usingdefinition.subdomains(string"abc"or array["a","b","c"]; defaults to["a","b","c"]).definition.urlis present without{s}→ returned as single-element array.API key injection:
{apikey}anddefinition.apiKeyis provided,{apikey}is replaced with the key value for all URLs.apiKeyis absent anddefinition.apiKeyRequiredistrue, a warning is emitted and an empty array is returned (basemap disabled).apiKeyis absent andapiKeyRequiredis not set (optional key, e.g. Stadia), the{apikey}placeholder and its query param are stripped — the URL remains valid for unauthenticated access.