如何使用 ngx-leaflet.markercluster 自定义标记簇
How can I customise marker clusters with ngx-leaflet.markercluster
我一直在尝试使用 ngx-leaflet 的自定义集群选项,但遇到了困难。现在我只想更改所有标记簇以显示单词 "hello",
演示 https://github.com/Asymmetrik/ngx-leaflet-markercluster/tree/master/src/demo/app contains variable but doesn't go any further and the docs https://github.com/Asymmetrik/ngx-leaflet-markercluster#leafletmarkerclusteroptions 指向传单自己的文档。
据我所知,我应该这样做:
markercluster-demo.component.ts
markerClusterGroup: L.MarkerClusterGroup;
markerClusterData: L.Marker[] = [];
markerClusterOptions = L.markerClusterGroup({
iconCreateFunction(cluster) {
return L.divIcon({ html: '<b>hello</b>' });
}
});
任何人都有它工作的例子吗?
谢谢
想通了
public markerClusterOptions: L.MarkerClusterGroupOptions = {
iconCreateFunction() {
const icon = L.divIcon({
iconSize: [35, 35],
iconAnchor: [10, 10],
popupAnchor: [10, 0],
shadowSize: [0, 0],
html: '<div>Hello</div>'
});
return icon;
}
};
我一直在尝试使用 ngx-leaflet 的自定义集群选项,但遇到了困难。现在我只想更改所有标记簇以显示单词 "hello",
演示 https://github.com/Asymmetrik/ngx-leaflet-markercluster/tree/master/src/demo/app contains variable but doesn't go any further and the docs https://github.com/Asymmetrik/ngx-leaflet-markercluster#leafletmarkerclusteroptions 指向传单自己的文档。
据我所知,我应该这样做:
markercluster-demo.component.ts
markerClusterGroup: L.MarkerClusterGroup;
markerClusterData: L.Marker[] = [];
markerClusterOptions = L.markerClusterGroup({
iconCreateFunction(cluster) {
return L.divIcon({ html: '<b>hello</b>' });
}
});
任何人都有它工作的例子吗?
谢谢
想通了
public markerClusterOptions: L.MarkerClusterGroupOptions = {
iconCreateFunction() {
const icon = L.divIcon({
iconSize: [35, 35],
iconAnchor: [10, 10],
popupAnchor: [10, 0],
shadowSize: [0, 0],
html: '<div>Hello</div>'
});
return icon;
}
};