我正在使用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 ] } }
]
}发布于 2020-11-04 04:22:15
有关此问题在mapbox代码中发生的位置和可能的解决方案,请参见mapbox issue comments:https://github.com/mapbox/mapbox-gl-js/issues/6454
https://stackoverflow.com/questions/64492138
复制相似问题