data
A dictionary of custom properties to use with the URL template.
Declaration
get data(): {
[key: string]: any;
};
set data(data: { [key: string]: any });Discussion
The data object holds a dictionary of custom properties to fill the urlTemplate.
If the urlTemplate is a callback, MapKit JS passes the entire data object as a parameter.
If the urlTemplate is a string,
datakey names should match up with the custom placeholder names. MapKit JS ignores the keys that don’t exist in the URL template string.
The default value is {}.
This example shows adding a customized tile overlay to a map.
const customOverlay = new mapkit.TileOverlay("https://{subdomain}.customtileserver.com/{z}/{x}/{y}?scale={scale}&lang={lang}&imageFormat=jpg");
customOverlay.data = {
subdomain: "staging",
lang: mapkit.language
};
map.addTileOverlay(customOverlay);