Ios 如何禁用“MGLSymbolStyleLayer”的群集化功能?
环境Ios 如何禁用“MGLSymbolStyleLayer”的群集化功能?,ios,swift,mapbox,Ios,Swift,Mapbox,环境 Mapbox iOS SDK 3.7.8 我已尝试使用MGLShapeSource禁用MGLSymbolStyleLayer的群集化 加载MGLMapView后,我制作MGLSymbolStyleLayer private func makeSymbolLayer(withId identifier: String, style: MGLStyle) { let options = [MGLShapeSourceOption.clustered: false as NSNumb
Mapbox iOS SDK 3.7.8
MGLShapeSource
禁用MGLSymbolStyleLayer
的群集化
加载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
禁用群集化?我无法重现此问题,但选项
是可选的。因此,您应该能够按顺序将其设置为nil
,而不会看到集群
let source=MGLShapeSource(标识符:标识符,功能:[],选项:nil)
某些功能可能会隐藏以避免图标重叠。如果要允许图标重叠,请设置为
YES
您认为iOS版Mapbox Maps SDK的哪个版本存在此问题?是。将iconAllowsOverlap
设置为YES
解决了我的问题。这是我的错误。我认为这是集群行为,但它不是集群。