Marker clusterer calls zoom_changed event of the map twice - google-maps-api-3

I'm using this third party library, called Marker Clusterer with the Google Maps API. http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererplus/docs/reference.html
I am trying to trigger an event when the map's zoom level is changed. The odd thing I've noticed though, is that when you click on a marker cluster, it calls the zoom event twice. Has anyone come across this odd error before? Why would it trigger the zoom callback twice? When I zoom normally without using clusters, the zoom callback is only called once.
Any ideas?

Looks like that behavior is a fix for an issue on IOS. You can download your own copy of the code and remove the additional call to fitBounds if you don't need it.

Related

Here map event equivalent to Google Map “idle” event

I can't seem to find the map event in Here that equals to Google Map "idle" event.
The definition of Google Map event "idle" is "This event is fired when the map becomes idle after panning or zooming."
So, when any of the map actions are done completely the map becomes idle and the idle event is fired — with this event i can guarantee all map's animations, actions and other stuff are done completely.
For example, if i zoom or pan the map with the animation option enabled zoom_changed and dragend events will be fired immediately but only after the idle event i can safely use getZoom or getBounds or getCenter methods and get correct values instead of some intermediate values (while animation is still running).
In Here maps i can see only pointer, drag and tap events. There is no any zoom change event at all. And all those events cannot guarantee the map is ready to give correct zoom/bounds/center/etc values after some interaction.
For example, Here dragend event is firing but drag animation is still running, so i cannot guarantee getBounds or getCenter will return correct values if i try to read them right in dragend callback.
In Yandex maps i have actionend event which is equivalent to the Google's "idle" event.
What i have in Here maps which is equal to the Google Map or Yandex Map "idle" event?
If you refer to the JavaScript API you may want to look at the mapviewchangeend event

does google map event triggers the google map to be reloaded?

I've recently created a website that display uses a Google map. I was wondering does the google.maps.event.trigger(map, 'resize') causes the map to be reloaded from Google? Or is it just plain UI redraw from local machine that doesn't call back to Google api?
from the documentation:
resize - None - Developers should trigger this event on the map when the div changes size: google.maps.event.trigger(map, 'resize').
This event informs the API that the map DIV has changed size, it will do what is needed, which may involve fetching additional tiles from the tile servers, but not necessarily (if the map got smaller, there shouldn't be any additional tiles required). It won't cause an additional load of the API.

google maps markers add easeout effect at setMap(null)

I have a Googlemap with multiple markers on that I refresh when moving around or zoom in/out the map. So far so good. The problem is that if a marker is refreshed, I mean repainted on the map, then it blinks for an instance, as it first gets deleted as an old marker and then painted as a new marker. I use setMap(null) to hide markers. Is there a way to avoid this blinking? Is there a way f.e. to add easingout effect at setMap(null) using jQuery or something?
Write your code to not do that. Don't delete all the existing markers, only delete those that no longer appear in the updated data and add new ones.

How to bind an infowindow as a property of a marker (google maps API v3)

Anyone know how to bind an infowindow as a property of a marker?
when I delete a marker, the infowindow goes with it also deleted.
I had a similar problem, my way around it was to suppress the built in info windows. From there I had the click event call a specific window from an array of info windows. That was my hackish way around making my own info windows without working with the given window.

Google Maps Api V3: Limit MarkerClusterer on certain zoom levels

I have a MarkerClusterer which i want to disable if the zoom level is below a threshold.
Example:
The zoom level is 10, the clusters are visible. The threshold is 5, so if the user zooms out to see the world, all Markers should not be rendered. I don't want to clear the markers though, because they need to be shown if the user zooms in again.
If you don't want to clear the markers, you can instead use setMap() to set the map, to which the MarkerCluster is assigned, to a different map than the one the user is viewing.
setMap() takes null as a valid parameter.
Another option is to do some awful hack, like creating a second map that is not visible to the user and assigning the MarkerCluster to that map. It won't win any coding competitions, but it will work.
Then, when you get back to an appropriate zoom level, you can use setMap() again to put the MarkerCluster back on the map.
You can use the zoom_changed event to detect when the zoom on the map has changed and call setMap() appropriately.
Hopefully, this is all you need to get this done, but if not, post some of your code and maybe we can try to be more specific about exactly how to modify it to achieve this.

Resources