Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

Title property for markers in markercluster group after filtering #14

Open
nmccready opened this issue Oct 29, 2015 · 0 comments
Open

Comments

@nmccready
Copy link
Contributor

From @mukhtyar on March 21, 2014 17:4

I am trying to find a marker within a markerclustergroup overlay by using the following code:

$timeout(function(){    
          leafletData.getLayers().then(function(layers) {
              $scope.markerClusterGrp = layers.overlays.locations;
              var clusters = $scope.markerClusterGrp.getLayers();
              for (var i in clusters){
                if (marker.title == clusters[i].options.title) {
                  childMarker = clusters[i];
                  break;
                } 
             }
          });       
},1000);

I'm assuming that the options.title property in the clusters object is same as the marker.title property that I initially defined while creating the markers. However once I apply a filter to the markers, the options.title property in the clusters object does not match up. To illustrate this I have created a fiddle:

http://jsfiddle.net/mukhtyar/pHeKJ/

If you open up the console and play around with the filter you will see a log of the $scope.marker titles and clusters options.titles.

I am not sure if my assumption about .title is incorrect or if this is a bug. Is there a better way to find a marker within a markerclustergroup? My eventual objective is to find the parent cluster of this marker and highlight it on a mouseover event. I am using latest v. of this directive, and angular 1.2.8. Thanks!

Copied from original issue: tombatossals/angular-leaflet-directive#337

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant