Latest 1.0.5
Homepage https://github.com/hotschedules/HSClusterMapView
License MIT
Platforms ios 8.0, requires ARC
Dependencies GoogleMaps
Frameworks UIKit, MapKit, GoogleMaps
Authors

Version
License
Platform

Description

HSClusterMapView is a subclass of GMSMapView (Google iOS SDK Map) which clusters groups of GMSMarkers and replaces them with a single GMSMarker, enabling the developer to generate a custom UIImage for each cluster marker on the fly.

Also included is a GMSMapView subclass, HSMapView, which will keep track of the markers on the GMSMapView for the developer. This is unlike the stock GMSMapView, which forces the developer to keep the GMSMarker objects they want to show on the map in data structure external to GMSMapView.

HSClusterMapView and HSMapView aim to provide more cohesive and full featured interfaces to work with the Google Maps for iOS SDK.

Example

alt tag

To run the example project, clone the repo, and run pod install from the Example directory first.

Basic Usage

An instance of HSClusterMapView should be created with the initializer:

- (instancetype)initWithFrame:(CGRect)frame renderer:(id<HSClusterRenderer>)renderer;

where renderer is responsible for generating a UIImage for each cluster which is shown on the map. Then, call:

- (void)addMarker:(GMSMarker *)marker;

to add markers to the map and call:

- (void)cluster;

to perform the clustering.

YOU DO NOT NEED TO SET GMSMarker’s "map" property when using HSClusterMapView or HSMapView!

Further Usage

HSClusterMapView has customizable parameters such as:

@property CLLocationDistance clusterSize;
@property NSUInteger minimumMarkerCountPerCluster;
@property BOOL clusteringEnabled;

HSMapView is the parent class of HSClusterMapView and has helpful methods GMSMapView does not such as:

- (void)addMarker:(GMSMarker *)marker;
- (void)addMarkers:(NSArray *)markers;
- (void)removeMarker:(GMSMarker *)marker;
- (void)removeMarkers:(NSArray *)markers;

and additional properties:

@property MKCoordinateSpan visibleSpan;
@property CGFloat visibleRadiusInMiles;
@property NSArray *displayedMarkers;

Documentation

HSClusterMapView, HSMapView and their associated classes are fully documented here on CocoaDocs.

Installation

HSClusterMapView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "HSClusterMapView"

License

HSClusterMapView is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "HSClusterMapView",
    "version": "1.0.5",
    "summary": "A GMSMapView subclass which clusters GMSMarkers within close proximity.",
    "description": "A GMSMapView subclass which clusters groups of GMSMarkers and replaces them with single GMSMarkers, enabling the developer to generate custom UIImages for each cluster on the fly. It also includes a GMSMapView subclass, HSMapView, which does not cluster GMSMarkers, but instead keeps track of the GMSMarkers on the map internally, eliminating the need to store them elsewhere. HSMapView aims to provide a clean map interface to work with the Google Maps for iOS SDK.",
    "homepage": "https://github.com/hotschedules/HSClusterMapView",
    "license": "MIT",
    "authors": {
        "abouzek": "[email protected]"
    },
    "source": {
        "git": "https://github.com/hotschedules/HSClusterMapView.git",
        "tag": "1.0.5"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "frameworks": [
        "UIKit",
        "MapKit",
        "GoogleMaps"
    ],
    "dependencies": {
        "GoogleMaps": [
            "~> 1.13.0"
        ]
    }
}

Pin It on Pinterest

Share This