Skip to content

feat(clustering): add AreaClusterProvider for on-demand spatial clustering and 2.72M buildings demo - #1811

Draft
dkhawk wants to merge 2 commits into
mainfrom
feat/area-cluster-provider
Draft

dkhawk wants to merge 2 commits into
mainfrom
feat/area-cluster-provider

Conversation

@dkhawk

@dkhawk dkhawk commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Decouples cluster data delivery from upfront in-memory collections by introducing a reactive, area-based callback clustering architecture (AreaClusterProvider). Demonstrates sub-millisecond querying and zero heap exhaustion on a real-world dataset of 2,719,379 building coordinates on Android.

Key Changes

  • AreaClusterProvider<T>: Functional interface invoked by ClusterManager with visible camera LatLngBounds and current zoom level.
  • AreaCluster<T>: Lightweight, immutable Cluster implementation that models both composite clusters (size >= 2) and leaf markers (size == 1).
  • AreaClusterProviderAlgorithm<T>: ScreenBasedAlgorithm that bridges viewport camera bounds to the area provider.
  • ClusterManager.setAreaClusterProvider(...): Convenience method to bind area providers with automatic main-thread projection viewport synchronization.
  • tools/preprocess_buildings.py: Offline Python tool to generate non-overlapping multi-resolution spatial pyramids (.scbin) using greedy radius clustering with spatial hash acceleration.
  • BinarySpatialPyramidStore: Zero-copy, memory-mapped spatial reader that queries latitude-sorted records using binary search in < 1ms.
  • BuildingMegaClusterDemoActivity: Showcase activity with real-time Map, Satellite, and Hybrid layer toggling, custom Hansel & Gretel candy house markers, and clean cluster separation.

@dkhawk
dkhawk requested a review from LoyalAbbas October 2, 2026 20:19
@googlemaps-bot

googlemaps-bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage

Overall Project 62.52% -0.22% 🍏
Files changed 61.02% 🍏

Module Coverage
Kover Gradle Plugin XML report for :clustering 47.42% -0.68% 🍏
Files
Module File Coverage
Kover Gradle Plugin XML report for :clustering AreaClusterProviderAlgorithm.kt 84.76% -15.24% 🍏
ClusterManager.kt 74.81% -6.22% ❌
AreaCluster.kt 56.7% -43.3% ❌

@dkhawk
dkhawk force-pushed the feat/supercluster-algorithm branch 2 times, most recently from 444687a to 0ecca9b Compare October 20, 2026 23:19
Base automatically changed from feat/supercluster-algorithm to main October 21, 2026 17:25
…ering and 2.72M buildings demo

- Add AreaClusterProvider functional interface and AreaCluster data model to decouple cluster delivery from upfront in-memory collections
- Add AreaClusterProviderAlgorithm ScreenBasedAlgorithm implementation that queries spatial providers using visible camera bounds and zoom level
- Add ClusterManager.setAreaClusterProvider convenience method and automatic viewport bounds propagation
- Add tools/preprocess_buildings.py to build hierarchical multi-zoom spatial pyramids using greedy radius clustering with guaranteed badge separation
- Add BinarySpatialPyramidStore memory-mapping .scbin spatial pyramids with zero-copy kernel page caching and sub-millisecond binary search queries (requiring cluster size >= 2 and omitting isolated single buildings below minZoomForLeafMarkers)
- Add BuildingMegaClusterDemoActivity showcasing 2,719,379 building coordinates with Hansel & Gretel candy cottage leaf markers, Map/Satellite/Hybrid layer switcher, and broadcast receiver for demo automation
- Update clustering.api binary compatibility declarations
@dkhawk
dkhawk force-pushed the feat/area-cluster-provider branch from ffb2b67 to 44f3a8f Compare October 21, 2026 18:29
Comment thread demo/src/main/res/drawable/ic_layers_24.xml Fixed
Comment thread demo/src/main/res/layout/activity_building_megacluster.xml Fixed
Comment thread demo/src/main/res/layout/activity_building_megacluster.xml Fixed
Comment thread demo/src/main/res/layout/activity_building_megacluster.xml Fixed
Comment thread demo/src/main/res/layout/activity_building_megacluster.xml Fixed
Comment thread demo/src/main/res/layout/activity_building_megacluster.xml Fixed
Comment thread demo/src/main/res/layout/activity_building_megacluster.xml Fixed
Comment thread demo/src/main/res/layout/activity_building_megacluster.xml Fixed
@dkhawk
dkhawk removed the request for review from LoyalAbbas October 21, 2026 19:05

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants