繁体   English   中英

即使放大,mapbox-gl 聚类点也位于同一位置

[英]mapbox-gl cluster points at same location even when zoomed in

我正在使用 mapbox-gl JS 并将我的一些位于同一位置(重叠)的源点聚类。

如果聚集的点仍在设置的 clusterRadius 内,有没有人知道在所有尺度上保持集群布局的方法? 我尝试更改缩放选项但没有成功。 如果您将聚类点放大到某个级别,即使这些点相互重叠并且仍在设置的半径内,聚类图层也将停止显示。

我可以做一些变通办法,比如偏移点,只是好奇这是否是预期的行为。 请参阅此处的文档示例: https : //docs.mapbox.com/mapbox-gl-js/example/cluster/

我正在使用不同的图层过滤器filter={['==', 'cluster', true]}

编辑示例以显示问题(取自上述示例的代码) https://jsfiddle.net/8z9p6cfu/13/放大到 6 点集群,在设置级别,即使仍有 6 个点相同,非集群层也将接管地点。

数据:

"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "id": "ak16994521", "mag": 2.3, "time": 1507425650893, "felt": null, "tsunami": 0 }, "geometry": { "type": "Point", "coordinates": [-118.497, 34.299667, 0.0 ] } },
{ "type": "Feature", "properties": { "id": "ak16994519", "mag": 1.7, "time": 1507425289659, "felt": null, "tsunami": 0 }, "geometry": { "type": "Point", "coordinates": [ -118.497, 34.299667, 105.5 ] } },
{ "type": "Feature", "properties": { "id": "ak16994517", "mag": 1.6, "time": 1507424832518, "felt": null, "tsunami": 0 }, "geometry": { "type": "Point", "coordinates": [-118.497, 34.299667, 0.0 ] } },
{ "type": "Feature", "properties": { "id": "ci38021336", "mag": 1.42, "time": 1507423898710, "felt": null, "tsunami": 0 }, "geometry": { "type": "Point", "coordinates": [ -118.497, 34.299667, 7.64 ] } },
{ "type": "Feature", "properties": { "id": "us2000b2nn", "mag": 4.2, "time": 1507422626990, "felt": null, "tsunami": 0 }, "geometry": { "type": "Point", "coordinates": [ -118.497, 34.299667, 46.41 ] } },
{ "type": "Feature", "properties": { "id": "ak16994510", "mag": 1.6, "time": 1507422449194, "felt": null, "tsunami": 0 }, "geometry": { "type": "Point", "coordinates": [ -118.497, 34.299667, 0.0 ] } }
]
}

有关此问题在 mapbox 代码中发生的位置和可能的解决方案,请参阅 mapbox 问题评论: https : //github.com/mapbox/mapbox-gl-js/issues/6454

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM