cordova-plugin-googlemaps icon indicating copy to clipboard operation
cordova-plugin-googlemaps copied to clipboard

Add "number" parameter to MarkerCluster

Open rcpinheiro opened this issue 4 years ago • 5 comments

When you add markers to MarkerCluster add a optional "number" parameter to the MarkerOptions (default: number=1). That way, MarkerCluster instead of showing the count of Markers, will show the sum of the "number" field in the Markers. Very useful when you try to add lots and lots of identifical markes. For instance, if you have 100 markers in the same location, you only have to add one marker with "number=100" instead of adding 100 markers.

Pull request guide

Thank you for considering to improve this cordova-plugin-googlemaps.

When you create a pull request, please make it to multiple_maps branch instead of master branch.

Because the multiple_maps branch is edge version.

Thank you for your understanding.

rcpinheiro avatar Jul 15 '20 17:07 rcpinheiro

Could you show me the screenshot? (I'm outside now)

wf9a5m75 avatar Jul 15 '20 17:07 wf9a5m75

Ah, I got your idea. You want to show the value of markers instead of number of markers.

wf9a5m75 avatar Jul 15 '20 17:07 wf9a5m75

Right. Three markers with "number" equal to 48, 11 and 2: image

When you zoom out: image

rcpinheiro avatar Jul 15 '20 17:07 rcpinheiro

On second thought, the name "number" is not a good one. It's best to call it "value" or "weight".

rcpinheiro avatar Jul 15 '20 17:07 rcpinheiro

@rcpinheiro Thank you for your PR. Your idea is good, but creating a special meaning property for particular is not good. Because some people might want to more complex calculation, such as return value * priority;

I also asked someone wanted to customize the strings of the number, such as 2532 -> 2.5k

So, I will create a custom callback instead of particular property.

wf9a5m75 avatar Jul 15 '20 20:07 wf9a5m75