Mapbox 相同的圆半径集群重叠和计数不显示
Mapbox same circle-radius clusters overlap and count not displayed
我们按照示例为我们的地图设置了数千个点的集群:https://www.mapbox.com/mapbox-gl-js/example/cluster/
我们希望所有簇的大小相同,但我们 运行 遇到了一个问题,即簇彼此重叠,因此并不总是显示簇内的计数,或者显示计数但该簇是未显示(另一个集群部分 hidden/overlapped)。我们尝试了 clusterRadius 的不同组合,(各种步骤)circle-radius/circle-color.
var map = makeMap({
container: 'map',
locationSearch: true,
zoom: 10
});
map.addSource("scheduled", {
type: "geojson",
data: geojsonScheduled,
cluster: true,
clusterMaxZoom: 24, // Max zoom to cluster points on
clusterRadius: 8 // Radius of each cluster when clustering points (defaults to 50)
});
map.addLayer({
id: "scheduled-clusters",
type: "circle",
source: "scheduled",
filter: ["has", "point_count"],
paint: {
"circle-color": [
"step",
["get", "point_count"],
"#f1733b",
100,
"#f1733b"
],
"circle-radius": [
"step",
["get", "point_count"],
10,
100,
10
],
"circle-stroke-width": 0.5,
"circle-stroke-color": "#ffffff"
}
});
map.addLayer({
id: "scheduled-cluster-count",
type: "symbol",
source: "scheduled",
filter: ["has", "point_count"],
layout: {
"text-field": "{point_count_abbreviated}",
"text-font": ["DIN Offc Pro Medium", "Arial Unicode MS Bold"],
"text-size": 9
}
});
map.addLayer({
id: "scheduled-unclustered-point",
type: "circle",
source: "scheduled",
filter: ["!has", "point_count"],
paint: {
"circle-color": "#f1733b",
"circle-radius": 4.5,
"circle-stroke-width": 0.5,
"circle-stroke-color": "#ffffff"
}
});
感谢任何帮助或指点。谢谢!
将 "text-allow-overlap" : true
添加到 scheduled-cluster-count 层的布局对象。这将显示缺失的计数。
我们按照示例为我们的地图设置了数千个点的集群:https://www.mapbox.com/mapbox-gl-js/example/cluster/
我们希望所有簇的大小相同,但我们 运行 遇到了一个问题,即簇彼此重叠,因此并不总是显示簇内的计数,或者显示计数但该簇是未显示(另一个集群部分 hidden/overlapped)。我们尝试了 clusterRadius 的不同组合,(各种步骤)circle-radius/circle-color.
var map = makeMap({
container: 'map',
locationSearch: true,
zoom: 10
});
map.addSource("scheduled", {
type: "geojson",
data: geojsonScheduled,
cluster: true,
clusterMaxZoom: 24, // Max zoom to cluster points on
clusterRadius: 8 // Radius of each cluster when clustering points (defaults to 50)
});
map.addLayer({
id: "scheduled-clusters",
type: "circle",
source: "scheduled",
filter: ["has", "point_count"],
paint: {
"circle-color": [
"step",
["get", "point_count"],
"#f1733b",
100,
"#f1733b"
],
"circle-radius": [
"step",
["get", "point_count"],
10,
100,
10
],
"circle-stroke-width": 0.5,
"circle-stroke-color": "#ffffff"
}
});
map.addLayer({
id: "scheduled-cluster-count",
type: "symbol",
source: "scheduled",
filter: ["has", "point_count"],
layout: {
"text-field": "{point_count_abbreviated}",
"text-font": ["DIN Offc Pro Medium", "Arial Unicode MS Bold"],
"text-size": 9
}
});
map.addLayer({
id: "scheduled-unclustered-point",
type: "circle",
source: "scheduled",
filter: ["!has", "point_count"],
paint: {
"circle-color": "#f1733b",
"circle-radius": 4.5,
"circle-stroke-width": 0.5,
"circle-stroke-color": "#ffffff"
}
});
感谢任何帮助或指点。谢谢!
将 "text-allow-overlap" : true
添加到 scheduled-cluster-count 层的布局对象。这将显示缺失的计数。