{"id":18389298,"url":"https://github.com/rightpoint/bentomap","last_synced_at":"2025-10-06T20:48:08.975Z","repository":{"id":56903631,"uuid":"62749676","full_name":"Rightpoint/BentoMap","owner":"Rightpoint","description":"Map Clustering for Swift.","archived":false,"fork":false,"pushed_at":"2017-02-15T15:12:22.000Z","size":2054,"stargazers_count":182,"open_issues_count":7,"forks_count":10,"subscribers_count":7,"default_branch":"develop","last_synced_at":"2025-03-22T11:42:44.780Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rightpoint.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-06T19:59:15.000Z","updated_at":"2024-05-24T08:27:39.000Z","dependencies_parsed_at":"2022-08-21T01:50:45.002Z","dependency_job_id":null,"html_url":"https://github.com/Rightpoint/BentoMap","commit_stats":null,"previous_names":["raizlabs/bentomap"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FBentoMap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FBentoMap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FBentoMap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FBentoMap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rightpoint","download_url":"https://codeload.github.com/Rightpoint/BentoMap/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247583260,"owners_count":20962000,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T01:42:27.060Z","updated_at":"2025-10-06T20:48:08.850Z","avatar_url":"https://github.com/Rightpoint.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BentoMap\n\u003e Map Clustering for Swift\n\n[![Build Status](https://travis-ci.org/Raizlabs/BentoMap.svg?branch=develop)](https://travis-ci.org/Raizlabs/BentoMap)\n[![Version](https://img.shields.io/cocoapods/v/BentoMap.svg?style=flat)](http://cocoapods.org/pods/BentoMap)\n[![License](https://img.shields.io/cocoapods/l/BentoMap.svg?style=flat)](http://cocoapods.org/pods/BentoMap)\n[![Platform](https://img.shields.io/cocoapods/p/BentoMap.svg?style=flat)](http://cocoapods.org/pods/BentoMap)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n\nBentoMap is an Swift implementation of [quadtrees][wiki] for map annotation clustering, and storage. It can also allow other 2d coordinate data to conform to a protocol and be added into `BentoBox` containers.\n\nFor more information, check out the [Raizlabs Developer Blog][rl]. The Android equivalent, known as \"Marker Clustering,\" is [documented here][mk].\n\n[wiki]: https://en.wikipedia.org/wiki/Quadtree\n[rl]: https://www.raizlabs.com/dev/2016/08/introducing-bentomap/\n[mk]: https://developers.google.com/maps/documentation/android-api/utility/marker-clustering\n\n![BentoMap](Resources/bento_animation3.gif)\n\n## Features\n\n- [x] Store annotation data in QuadTrees\n- [x] Fetch annotations in a region, with a clustering threshold\n- [x] Protocols for storing other data types\n\n## Requirements\n\n- iOS 9.0+\n- Xcode 8.0\n\n## Installation\n\n#### CocoaPods\nBentoMap is available through [CocoaPods][cp]. To install it, simply add the following line to your Podfile:\n\n```ruby\npod 'BentoMap'\n```\n\n#### Carthage\nCreate a `Cartfile` that lists the framework and run `carthage update`. Follow the [instructions][carthage] to add `$(SRCROOT)/Carthage/Build/iOS/BentoMap.framework` to an iOS project.\n\n```ogdl\ngithub \"Raizlabs/BentoMap\"\n```\n\n#### Manually\n1. Download all of the `.swift` files in `BentoMap/` and `BentoMap/Extensions/` and drop them into your project.  \n2. Congratulations!  \n\n\n[cp]: http://cocoapods.org/\n[carthage]: https://github.com/Carthage/Carthage#if-youre-building-for-ios\n\n## Usage example\n\nTo see a full implementation of loading data into a map view, check out the [example project][ex].\n\n### Inserting Data\n\n```swift\nimport BentoMap\n\nstatic var sampleData: QuadTree\u003cInt, MKMapRect, MKMapPoint\u003e {\n    var samples = QuadTree\u003cInt, MKMapRect, MKMapPoint\u003e(bentoBox: BentoBox(minPoint: MKMapPointForCoordinate(CLLocationCoordinate2D.minCoord), maxPoint: MKMapPointForCoordinate(CLLocationCoordinate2D.maxCoord)), bucketCapacity: 5)\n    let randomData = (1...5000).map { count in\n        return QuadTreeNode(originCoordinate: MKMapPointForCoordinate(CLLocationCoordinate2D.randomCoordinate()), content: count)\n    }\n    for node in randomData {\n        samples.insertNode(node)\n    }\n    return samples\n}\n\n```\n\n### Updating a Map View\n\n```swift\nfunc updateAnnotations(inMapView mapView: MKMapView,\n                                 forMapRect root: MKMapRect) {\n    guard !mapView.frame.isEmpty \u0026\u0026 !MKMapRectIsEmpty(root) else {\n        mapView.removeAnnotations(mapView.annotations)\n        return\n    }\n    let zoomScale = Double(mapView.frame.width) / root.size.width\n    let clusterResults = mapData.clusteredDataWithinMapRect(root,\n                                    zoomScale: zoomScale,\n                                    cellSize: Double(MapKitViewController.cellSize))\n    let newAnnotations = clusterResults.map(BaseAnnotation.makeAnnotation)\n\n    let oldAnnotations = mapView.annotations.flatMap({ $0 as? BaseAnnotation })\n\n    let toRemove = oldAnnotations.filter { annotation in\n        return !newAnnotations.contains { newAnnotation in\n            return newAnnotation == annotation\n        }\n    }\n\n    mapView.removeAnnotations(toRemove)\n\n    let toAdd = newAnnotations.filter { annotation in\n        return !oldAnnotations.contains { oldAnnotation in\n            return oldAnnotation == annotation\n        }\n    }\n\n    mapView.addAnnotations(toAdd)\n}\n```\n\n[ex]: https://github.com/Raizlabs/BentoMap/blob/develop/BentoMapExample/App/MapKitViewController.swift\n\n## Contributing\n\nIssues and pull requests are welcome! Please ensure that you have the latest [SwiftLint][sl] installed before committing and that there are no style warnings generated when building.\n\nContributors are expected to abide by the [Contributor Covenant Code of Conduct][cc].\n\n[sl]: https://github.com/realm/SwiftLint\n[cc]: https://github.com/Raizlabs/BentoMap/blob/develop/CONTRIBUTING.md\n\n## License\n\nBentoMap is available under the MIT license. See the `LICENSE` file for more info.\n\n## Authors\n\n- Michael Skiba: \u003cmailto:mike.skiba@raizlabs.com\u003e, [@atelierclkwrk][mstw]\n- Rob Visentin: \u003cmailto:rob.visentin@raizlabs.com\u003e\n- Matt Buckley: \u003cmailto:matt.buckley@raizlabs.com\u003e, [@mattthousand][mbtw]\n\n[mstw]: https://twitter.com/atelierclkwrk\n[mbtw]: https://twitter.com/mattthousand\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frightpoint%2Fbentomap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frightpoint%2Fbentomap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frightpoint%2Fbentomap/lists"}