Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. // Add Source
  2. val options = GeoJsonOptions().withCluster(true).withClusterRadius(30)
  3. val stopSource = GeoJsonSource(sourceId, collection, options)
  4. style.addSource(stopSource)
  5.  
  6. // Add single layer
  7. val singleLayer = SymbolLayer(singleLayerId, sourceId).apply {
  8. withProperties(
  9. PropertyFactory.iconImage(singleLayerId),
  10. PropertyFactory.iconAllowOverlap(true)
  11. )
  12. }
  13.  
  14. style.addImage(singleLayerId, singleIcon)
  15. style.addLayer(singleLayer)
  16.  
  17.  
  18. // Add cluster layer
  19. val clusterLayer = SymbolLayer(clusterLayerId, sourceId).apply {
  20.  
  21. setFilter(eq(get("cluster"), true))
  22.  
  23. withProperties(
  24. PropertyFactory.iconImage(clusterLayerId),
  25. PropertyFactory.iconAllowOverlap(true)
  26. )
  27. }
  28.  
  29. style.addImage(clusterLayerId, clusterIcon)
  30. style.addLayer(clusterLayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement