rungwiroon / BlazorGoogleMaps

Blazor interop for GoogleMap library
MIT License
319 stars 102 forks source link

Market Clustering - Minimum batch size and/or zoom level #285

Closed MikeReedGH closed 9 months ago

MikeReedGH commented 9 months ago

Hi,

Many thanks for the component, it's fab! I would like to be able to control the minimum marker cluster size (e.g. 3 or 4 markers) or set the zoom level for when clustering should happen. Is either of those currently possible? I cannot see anything in the wrapping 'MarkerClustererOptions' class.

Thanks in advance for your help. Mike R

valentasm1 commented 9 months ago

Do you have js reference? Or even example?

MikeReedGH commented 9 months ago

Thanks for replying :)

I believe there are 2 properties that you can set in the javascript 'markerclusteroptions':

The first controls how many markers per cluster, and the second controls at what level clustering should stop and all markers should then show.

Here is a working google example (if you view the source you can see those two properties): https://googlemaps.github.io/v3-utility-library/packages/markerclustererplus/examples/advanced_example.html

And also if you search for those property names in the javascript included within your component, you will see they are referenced within there as well: https://unpkg.com/@googlemaps/markerclusterer@2.5.1/dist/index.min.js

So do you think it would just be the case of adding those properties to your wrapping C# class: https://github.com/rungwiroon/BlazorGoogleMaps/blob/master/GoogleMapsComponents/Maps/MarkerClustererOptions.cs

I see some properties are already in there and commented out. But unsure as to the history of why this is.

Thanks!

valentasm1 commented 9 months ago

You didnt provide example or reference. You just making assumptions. You example is from previous clustering lib. I think your desired result is controlled via algorithm. I think i could try find person who migrated from "old" to current version of clustering

MikeReedGH commented 9 months ago

Apologies, I didn’t realise that was from a previous library. Are you sure about that though, as those property names still exist in the referenced JavaScript file.

I did also wonder about the algorithm, but can find no examples.

Thanks

valentasm1 commented 9 months ago

Thats from other library at all. Nothing related to google one. Npm is deprecated, so not sure about library as it is https://googlemaps.github.io/js-markerclustererplus/index.html

Here is example of algorithm. Check our server side demos. They are gold. https://github.com/rungwiroon/BlazorGoogleMaps/blob/master/ServerSideDemo/Pages/MapMarker.razor.cs#L76

Here are some officials one, but i think you still need to use like our way. And finally use stackoverflow https://github.com/googlemaps/js-markerclusterer#examples https://googlemaps.github.io/js-markerclusterer/public/algorithms/ https://googlemaps.github.io/js-markerclusterer/public/renderers/

Closing. Did 15min research and found all this info.

MikeReedGH commented 9 months ago

OK - Thanks for your help.