populateTemplatePlaceholders method
- @visibleForOverriding
- String urlTemplate,
- TileCoordinates coordinates,
- TileLayer options
Replaces placeholders in the form templatePlaceholderElement with their corresponding values
Avoid using this externally, instead use getTileUrl (which uses this) to automatically handle WMS usage.
When creating a specialized TileProvider, prefer overriding URL generation related methods in the following order:
Note to implementors: it is not safe to assume that at least one of
wmsOptions
or urlTemplate
will be non-null.
Implementation
@visibleForOverriding
String populateTemplatePlaceholders(
String urlTemplate,
TileCoordinates coordinates,
TileLayer options,
) {
final replacementMap =
generateReplacementMap(urlTemplate, coordinates, options);
return urlTemplate.replaceAllMapped(
templatePlaceholderElement,
(match) {
final value = replacementMap[match.group(1)!];
if (value != null) return value;
throw ArgumentError(
'Missing value for placeholder: {${match.group(1)}}',
);
},
);
}