cyberhobo / wordpress-geo-mashup

Official repository for Geo Mashup, the plugin that makes WordPress into a GeoCMS. Documentation:
https://github.com/cyberhobo/wordpress-geo-mashup/wiki/Getting-Started
63 stars 15 forks source link

cluster zoom-in partially not working #778

Open bastianandre opened 7 years ago

bastianandre commented 7 years ago

Hey there!

I encountered some strange behavior:

At a point, where there were 6 posts clustered together, the zooming-in by clicking on the cluster did not work properly, it just centered the map around the cluster. After a second click on the cluster, all pins and clusters disappeared altogether. I thought it cured itself after adding some more posts, but on 19 (also 21, 28, 33 and 56 and 57) clustered posts the same problem occurred.

Does anyone have a suggestion, why that might be, or experienced something similar?

PS: I tried clustering on different zoom levels, and different browsers – the issue stayed the same. The Console did not throw any errors 🙁

PPS: the page I am referring to is http://tischnotizen.de/

bastianandre commented 7 years ago

UPDATE (for those who might experience a similar problem):

I was able to narrow it down. Other maps on my webpage, with the same configuration, work just fine, whereas the little preview map (300px by 200px) in my sidebar experiences the issues described above. Now, my assumption is that the problem lies in the available dimensions of the map. If zooming-in and decluttering the markers would spread them too far apart to fit on the new zoom level, the cluster refuses to dissolve.

Is there an option to manipulate the cluster radius? Or do you guys have another suggestion for a workaround?

cyberhobo commented 7 years ago

Thanks for the research. I think this may be a known issue in the clustering library:

https://github.com/googlemaps/js-marker-clusterer/issues/7

Unfortunately Google seems to have abandoned the library, but a user has forked it and made some updates:

https://github.com/gmaps-marker-clusterer/gmaps-marker-clusterer

I don't see that this particular issue has been addressed, but it might be worth some experimenting with the examples.

There is an action for modifying the clusterer options, but cluster radius is not one of them:

https://github.com/cyberhobo/wordpress-geo-mashup/blob/master/js/geo-mashup-markerclusterer.js#L56

Looking at that other issue, playing with the max zoom might help.