// Leaflet:
L.TileLayer.Custom = L.TileLayer.extend({
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors',
getTileUrl({x, y, z}) {
if (y < 0) {
y = 0;
}
const _x = 'C' + padStart(correctEdges(z, x).toString(16), 8, '0');
const _y = 'R' + padStart(y.toString(16), 8, '0');
const _z = 'L' + padStart(z.toString(10), 2, '0');
return `${url()}${this.options.path}/${_z}/${_y}/${_x}.${this.options.imgType}`;
}
});
Я создаю URL-адрес плитки в листовке.Как передать возвращенный URL-адрес моих пользовательских листов карты элементу TileLayer Reaction-leaflet?Я не буду использовать http://{s}.tile.osm.org/{z}/{x}/{y}.png.
Вместо этого строка динамически обновляется
${url()}${this.options.path}/${_z}/${_y}/${_x}.${this.options.imgType}
url = <string>
// React-Leaflet:
<TileLayer
attribution='© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
url="http://{s}.tile.osm.org/{z}/{x}/{y}.png"
/>