[英]Change marker icon
如何更改具有群集的tomtom map API的標記圖標? 以下是我的代碼。 我是這個API的新手。 並且也幫助我更改集群圖標
var addressPoints = [
[40.191891, -85.401695, '<b style="color:red;">Townsville</b>'],
[33.830517, -116.545601, '<b style="color:red;">Townsville</b>'],
[34.496212, -93.057220, '<b style="color:red;">Townsville</b>'],
[34.521530, -93.042267, '<b style="color:red;">Townsville</b>'],
[37.541290, -77.434769, '<b style="color:red;">Townsville</b>'],
[32.698437, -114.650398, '<b style="color:red;">Townsville</b>'],
[37.063969, -111.236816, '<b style="color:red;">Townsville</b>'],
[33.580944, -112.237068, '<b style="color:red;">Townsville</b>']
];
// Creating the map
var map = tomtom.map('map', {
key: 'AVjNSUnrzh6XFxaTHO79YVHFw0H0KfyA',
basePath: 'sdk'
}).setView([40.191891, -85.401695], 5);
//
var markerOptions = {
icon: tomtom.L.icon({
iconUrl: 'https://eyeonjewels.com/includes/images/retailer-large-icon.png',
iconSize: [50, 64],
})
};
// Placing markers
var markers = tomtom.L.markerClusterGroup();
addressPoints.forEach(function (point) {
var title = point[2];
marker = tomtom.L.marker(new tomtom.L.LatLng(point[0], point[1]), { title: title });
marker.bindPopup(title);
markers.addLayer(marker);
});
map.addLayer(markers);
請幫助我更改標記圖標。
嘗試按如下所示設置標記時添加它-
marker = tomtom.L.marker(new tomtom.L.LatLng(point[0], point[1]), { title: title, icon: markerOptions.icon });
在這里了解更多
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.