Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sandydoo/ember-google-maps-markerclustererplus

A marker clustering addon for ember-google-maps
https://github.com/sandydoo/ember-google-maps-markerclustererplus

ember-addon ember-google-maps ember-google-maps-addon emberjs google-maps markerclustererplus

Last synced: about 1 month ago
JSON representation

A marker clustering addon for ember-google-maps

Awesome Lists containing this project

README

        

# MarkerClustererPlus for Ember Google Maps

[![Latest version][npm-version-badge]][npm-url]

Add marker clustering to [ember-google-maps][ember-google-maps] using [@googlemaps/markerclustererplus][@googlemaps/markerclustererplus].

> What is clustering?
>
> Drawing a lot of markers in close proximity can quickly turn into a usability nightmare. Grouping, or clustering, markers is a common way of simplifying how markers are displayed when used in large numbers.

πŸ”— Compatibility
------------------------------------------------------------------------------

* Ember Google Maps v4.2 or above
* Ember.js v3.16 or above
* Ember CLI v3.16 or above
* Node.js v10 or above

βš™οΈ Installation
------------------------------------------------------------------------------

```
ember install ember-google-maps-markerclustererplus
```

⭐ Usage
------------------------------------------------------------------------------

[A version of the following guide, together with a demo, is included in the ember-google-maps docs β†’][ember-google-maps-clustering-guide].

#### Cluster some markers

The `markerClusterer` works in the same way as any other [ember-google-maps][ember-google-maps] component. If you're not sure what that means, [read through the general guide for ember-google-maps β†’][ember-google-maps-guide].

The MarkerClustererPlus library accepts a bunch of options to configure the clusters. As with any map component, you can pass these options straight to the `markerClusterer` component. [Here’s a full list of supported options β†’](https://googlemaps.github.io/js-markerclustererplus/interfaces/markerclustereroptions.html)

The `markerClusterer` yields its own special `marker` that's added to the cluster instead of the map. Don’t confuse it with the regular marker yielded by the map itself!

```hbs

{{#each this.locations as |location|}}

{{/each}}

```

#### Handle events

You can also register events. You've got your usual suspects, like `click`, `dblclick`, and others; and also two special events: `clusteringbegin` and `clusteringend`. These are both native, albeit poorly publicized, MarkerClustererPlus events. But beware! These clustering events may be called several times during a single render because MarkerClustererPlus clusters markers in batches.

```hbs

{{#each this.locations as |location|}}

{{/each}}

```

#### Get the `MarkerClusterer` instance

The best way to do this is to register a one-time event with `@onceOn`.

```hbs

{{#each this.locations as |location|}}

{{/each}}

```

#### More cluster icons

The MarkerClustererPlus library comes with a small collection of default cluster icons to choose from. They're all copied to `/assets/markerclustererplus/images/`.

πŸ˜‡ Maintainers
--------------------------------------------------------------------------------

This addon is maintained by **[Sander Melnikov][maintainer-url]**.

Contributing
------------------------------------------------------------------------------

See the [Contributing](CONTRIBUTING.md) guide for details.

License
------------------------------------------------------------------------------

[MIT][license-url] Β© [Sander Melnikov][maintainer-url].

This software is not endorsed, maintained, or supported by Google LLC.

Β© 2021 Google LLC All rights reserved. Google Mapsβ„’ is a trademark of Google LLC.

[npm-version-badge]: https://img.shields.io/npm/v/ember-google-maps-markerclustererplus.svg?label=latest
[npm-url]: https://www.npmjs.org/package/ember-google-maps-markerclustererplus

[ember-google-maps]: https://github.com/sandydoo/ember-google-maps
[ember-google-maps-guide]: https://ember-google-maps.sandydoo.me/docs/getting-started
[ember-google-maps-clustering-guide]: https://ember-google-maps.sandydoo.me/docs/clustering
[@googlemaps/markerclustererplus]: https://github.com/googlemaps/js-markerclustererplus

[maintainer-url]: https://github.com/sandydoo
[license-url]: https://github.com/sandydoo/ember-google-maps-markerclustererplus/blob/main/LICENSE