ios - 如何禁用“MGLSymbolStyleLayer”的聚类功能?
问题描述
环境
Mapbox-iOS-SDK 3.7.8
我试图为MGLSymbolStyleLayer
with禁用集群化MGLShapeSource
。
加载后MGLMapView
我做MGLSymbolStyleLayer
private func makeSymbolLayer(withId identifier: String, style: MGLStyle) {
let options = [MGLShapeSourceOption.clustered: false as NSNumber]
let source = MGLShapeSource(identifier: identifier, features: [], options: options)
let layer = MGLSymbolStyleLayer(identifier: identifier, source: source)
style.addSource(source)
style.addLayer(layer)
}
然后,当我从服务器获取数据时,我填充了一个形状。我用不同的图标创建功能。
source.shape = MGLShapeCollectionFeature(shapes: loadedFeatures)
但无论如何,集群化总是开启的。是否可以禁用集群化MGLSymbolStyleLayer
?
解决方案
我无法重现此问题,但这options
是可选的。因此,您应该能够将其设置为nil
按顺序排列,而不会看到集群。
let source = MGLShapeSource(identifier: identifier, features: [], options: nil)
某些功能可能会隐藏以避免图标重叠。如果您想允许图标重叠,请设置iconAllowsOverlap
为YES
。
推荐阅读
- ios - 应用程序终止或在后台时在 IOS 设备上进行实时位置跟踪
- python - 如何使用 Anaconda 提示符安装 Rasa NLU
- azure - 如何获取 azure blob 的复制状态
- java - 在 JTextPane 中转换为大写或小写时,文本样式和格式正在发生变化
- mysql - 从 MYSQL 中删除超过 X 天的数据,Unix 时间以毫秒为单位
- php - 无法在 1.7.4.3 上删除产品组合
- ios - 可能丢失钥匙串访问权限
- javascript - 无法在 PDFjs 中为 pdf.worker.js 指定自定义路径
- angularjs - AngularJS 加载资源失败:服务器响应状态为 403 ()
- thingsboard - Thingboard:从内部数据库获取资产 ID