Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Add Source
- val options = GeoJsonOptions().withCluster(true).withClusterRadius(30)
- val stopSource = GeoJsonSource(sourceId, collection, options)
- style.addSource(stopSource)
- // Add single layer
- val singleLayer = SymbolLayer(singleLayerId, sourceId).apply {
- withProperties(
- PropertyFactory.iconImage(singleLayerId),
- PropertyFactory.iconAllowOverlap(true)
- )
- }
- style.addImage(singleLayerId, singleIcon)
- style.addLayer(singleLayer)
- // Add cluster layer
- val clusterLayer = SymbolLayer(clusterLayerId, sourceId).apply {
- setFilter(eq(get("cluster"), true))
- withProperties(
- PropertyFactory.iconImage(clusterLayerId),
- PropertyFactory.iconAllowOverlap(true)
- )
- }
- style.addImage(clusterLayerId, clusterIcon)
- style.addLayer(clusterLayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement