dylanfprice / angular-gm

AngularJS Google Maps Directives
MIT License
198 stars 47 forks source link

using angular-gm with MarkerClusterer #87

Closed nicksche closed 7 years ago

nicksche commented 7 years ago

I want to use Google MarkerClusterer for grouping markers, but i can't get instance for map and marker .

Maybe you know some other way to realize grouping for markers ?

Thanks, Nick

dylanfprice commented 7 years ago

Hi Nick,

If you need a direct handle on the map, you can do so as outlined here http://dylanfprice.github.io/angular-gm/2.0.1/docs/#/api/angulargm.service:angulargmContainer. From there you can probably achieve what you want though it might be messy.

A cleaner approach would probably be to implement your own directive which utilizes the angulargmMapController https://github.com/dylanfprice/angular-gm/blob/master/src/controllers/angulargmMapController.js and it's associated methods to manipulate the markers. For instance you can call controller.forEachElement('marker', myFn) to put your markers into different groups.

Hope that helps.

On Wed, Jan 11, 2017 at 11:46 PM, nicksche notifications@github.com wrote:

I want to use Google MarkerClusterer for grouping markers, but i can't get instance for map and marker .

Maybe you know some other way to realize grouping for markers ?

Thanks, Nick

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dylanfprice/angular-gm/issues/87, or mute the thread https://github.com/notifications/unsubscribe-auth/AANc_pJDwZcKs2I4Q1FbA_Uhy_Nv1UHWks5rRdpqgaJpZM4Lhdbp .

rognstad commented 7 years ago

I've been working on this a bit and have made some progress, but I'm having a problem when I have several sets of markers and only want to group one of them. Because of transclusion, I'm not sure how to find the correct scope ID for the set of markers I am interested in.

Here's a little demo: http://plnkr.co/edit/itJxTv?p=preview