Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't display anything when only one marker is present #1063

Open
RoboVij opened this issue May 24, 2022 · 10 comments
Open

Doesn't display anything when only one marker is present #1063

RoboVij opened this issue May 24, 2022 · 10 comments

Comments

@RoboVij
Copy link

RoboVij commented May 24, 2022

I'm not reporting a bug, asking for help.

Clustering works properly when multiple (even only 2) markers are present but when I filter to 1 marker, it's not displaying anything. But in a different project it works fine even when it's just 1 marker i.e. it displays the marker icon instead of cluster icon and that's fine. I'm using almost the same code in both projects. Any idea what could cause this problem of not displaying, theoretically?

@BartjeD
Copy link

BartjeD commented Jun 7, 2022

Were you able to solve this?

I'm having the same issue.

@RoboVij
Copy link
Author

RoboVij commented Jun 8, 2022

@BartjeD Unfortunately, no.

@BartjeD
Copy link

BartjeD commented Jun 8, 2022

I worked around it by adding a fake marker if there was only 1 marker in the collection.
Just copy the position of the first marker and it displays the markers on the map.

Obviously we needed to adjust the count mechanism as well, to exclude the fake marker from the count.

It's very ugly and probably only works in this exact situation.

We noticed sometimes clusters with only 1 marker also don't show on the map, so we suddely miss clusters after zooming.
If we can recognize those clusters with only one marker programatically this hack wil also work there.

But I didn't take it that far. (yet)

@RoboVij
Copy link
Author

RoboVij commented Jun 8, 2022

Sounds like a good enough workaround.

But I guess there won't be any one-marker clusters. From what I understood, the plugin displays the marker instead of cluster in the only-one-marker case, even after zooming in.

@BartjeD
Copy link

BartjeD commented Jun 8, 2022

They overlap perfectly if you copy the coordinates, you can also hide them via CSS if you want.

In our case we don't show the markers. For low-zoom navigation purposes.
With only the clusters it wasn't a problem anyway.

@bonga1245
Copy link

Hi @BartjeD @RoboVij
I am experiencing the same issue Did you find any good solution to the problem?

@BartjeD
Copy link

BartjeD commented Oct 17, 2022

We're still using the mentioned work around.

@NikiSkaarup
Copy link

If it helps anyone my solution is to just skip the usage of markercluster and add it directly to the map instead when there is only one marker

@BeAllAround
Copy link

BeAllAround commented Nov 26, 2022

Hi everyone,

Please, have a look at

https://stackoverflow.com/questions/57383443/single-marker-fails-to-get-rendered-if-it-is-not-in-or-close-to-a-cluster

I provided a description as to why this occurs. Hope it helps

@BartjeD
Copy link

BartjeD commented May 16, 2023

In our case we still require the work around even if we apply the zoom rounding you mentioned. @BeAllAround

It doesn't seem to be the same issue.

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

No branches or pull requests

5 participants