我正在使用maplibre gl添加制造商集群,当标记不聚类时,我想根据该功能的geojson属性中存在的id将特定图像添加到单个标记。
https://maplibre.org/maplibre-gl-js-docs/example/cluster/
这是简单的聚类示例,有人可以帮忙吗?
你可以这样处理
this.map.loadImage(
"example.com" // or base 64,
(error, image) => {
if (error) throw error;
this.map.addImage("shop", image);
}
);
and then use it in this way:
this.map.addLayer({
id: "unclustered-point",
type: "symbol",
source: "cluster-source",
filter: ["!", ["has", "point_count"]],
layout: {
"icon-image": "shop", // the name of that image that you added
"icon-size": 0.5, // Size of the icon
"icon-allow-overlap": true,
},
});