google api v3: disable all effects/animations - javascript

How to disable all effects and animations in google api v3? Is there some equivalent of jQuery.fx.off? If google api used some base library like jquery that would be easy... but this is probably not the case. I just want to disable them ALL. For example:
animated zoom
fading layers on layer switching
InfoWindow anchor is animated when InfoWindow is added, also map pan is animated in this case
... etc.
Or, if disabling them all is not possible, how to disable the particular effects listed above?
It is needed for running it in IE6 which is very slow (note that google api v3 seems to work in this browser), also desirable for other IE versions on slower computers.

There's no general "turn everything off" facility. You need to select what you want to turn off and do each individually, if that's actually possible...
You can't disable animated zoom. This is the subject of a long-standing enhancement request which has been marked WontFix.
There's no option to disable layer-switch fade. I don't think there's an enhancement request, either.
Panning for InfoWindows is controlled by the disableAutoPan option for each InfoWindow. You can set that option individually with InfoWindow.setOptions().
IE6 is not a supported browser for Version 3. If it works, it's a bonus.

By happenstance I needed to slightly pan my map to have all the markers show up. Besides fixing that problem, the map stopped animating on the various zooms. The effect is not exactly what one might want (the map goes blank, then the markers zoom to their spots, then the map with its new extents shows up), but it's better for what I need, and maybe it's better for you. Here's the bottom of my function that puts markers on the map:
map.fitBounds(latlngbounds);
//This minimum zoom trick I got from StackOverflow:
google.maps.event.addListenerOnce(map, 'bounds_changed', function(event){
if (this.getZoom() >= 5){
this.setZoom(5)
}
});
map.panBy(1,0);

Related

Google maps overlapping marker spiderfier ALWAYS keep spiderfied

Overlapping markers are unspiderfied when I click the map even though I have {keepSpiderfied: true}, how can I always keep all markers spiderfied?
Hitbox on my custom markers are also buggy when I have more than 2 markers overlapping, any solution to this would be insanely helpful.
Thx!
The sole purpose of keepSpiderfied is to avoid unspiderfying when you click on a marker.
Clicking on the map will call unspiderfy regardless of that setting, and so does changing zoom or mapType.
So I guess your only choice here is to fork the repo, or just download the library and add it to version control making your own modifications.

Loading google map polygon on IE slowly

everyone. Recently, we have faced one problem about the speed of loading google map components on different broswer. Regarding to the function , we have added 120 polygons, 360 sector ( also polygon ) and several attributes which attach to components on the map. The verson of JS tool is Google Map Javascript V3.
Now, this module is running fast and smoothly on Chrome and Foxfire broswer. HOWEVER, terreble problem would occur on IE8 or IE9. The process about loading informations into map becomes very slow, also during the period of dragging or zooming the map, which can not be accepted by users.
So, is there any solution about acceleration in this situation ?
Thank you very much for any reply !
In my experience it's just IE being IE.
I would suggest scaling down the number of polygons you need to show at one time by using the map bounds as the criteria to filter by. You'll still end up running into issues if you let the users zoom out to show the whole map so you may want to limit zoom levels as well.
If you take all the points that make up your polygon and push(extend) them to a LatLngBounds you can grab the bounding box and check to see if the center of that bounding box is in the map's current bounds.

How to refresh Bing Maps AJAX?

I create Bing Maps AJAX control and initialize it with always the same values: lat, lng and zoom level. This is a default aerial map type and a maximum zoom level. And every time I get the following image:
http://i50.tinypic.com/acturr.jpg
There is no documented method (or not) to refresh the current area so I should to do zoom out and zoom in using mouse every time, it's annoying. For Google Maps I found a useful trick:
google.maps.event.trigger(this.map, 'resize');
Does Bing Maps AJAX API have something similar?
I have recently encountered a similar issue on Bing maps AJAX V7:
On some browsers (Mostly on Chrome), if the map is not present on the viewport (you have to scroll to reach it), then it initializes improperly.
I have reported the issue to MSDN but didn't get any useful answer: https://social.msdn.microsoft.com/Forums/en-US/439c33bc-a1ed-4e74-a019-f7fecb809030/scroll-issue-on-chrome-with-ajax-v7-control
To fix this issue, I have used two things:
First of all, I had to find a way to force the Bing map to refresh (didn't found any solution on the internet nor object method to do that). After a lot of tests I came out with a solution:
map.setMapType(Microsoft.Maps.MapTypeId.mercator);
setTimeout(function(){map.setMapType(Microsoft.Maps.MapTypeId.auto);}, 1)
Indeed, changing the viewport to "mercator" then back to another forces the map to refresh (the setTimeout makes the action asynchronous)
I then have added a lib that triggers an event when an element is entering the viewport in order to trigger the force refresh every time the map enters the viewport

CloudMade Marker Overlays - Can The Z-Index Be Controlled?

Does the CloudMade API have the ability to control the z-order or z-index of the marker overlays (e.g.icons)?
I have used this before in Google Maps to make certain icons with more importance draw over the top of other icons with lesser importance (especially in some zoom levels where they may bunch together).
The Google Maps GMarker has the zIndexProcess option to handle this. Does anyone know if CloudMade has this facility? I have scoured the API docs and found nothing. Or does anyone here perhaps have an ad-hoc method that ensures one marker (or group of makers) will be drawn on a layer above the other?
Currently this feature is not available at CloudMade, but I'll add it to our Feature Requests list..

Google Maps Best Practices?

We started using Google Maps on our web application rather extensively. It worked fine at the beginning, but as we add more markers we find that the performance are not quite there. Although I'm quite sure we don't use it in the most efficient way.
I am looking for information about Google Maps best practices and tips'n tricks. Any suggestions?
You might find some good ideas in this article, which compares several methods of handling large amounts of markers.
Marker Manager has some limitations, depending on what you're trying to accomplish; for instance, it doesn't allow every marker to be available from every zoom level. I created a clustering function based on the principles discussed in this tutorial. It uses the Static Maps API in PHP, but the principles behind the clustering can be used however you want.
Update: This clustering utility was just released: MarkerClusterer
Use Marker Manager.
Limit markers to what's visible (ie, understand the window boundaries, and only show markers that fall inside the window)
Learn to listen for various map activities and react - such as viewpoint moves, zooming, etc - to update the markers
Don't show markers that overlap significantly - show only one marker (perhaps a different shade or color to denote there are several points at this marker) and let the user zoom in if they want to see the individual markers. Use the tooltip to show a zoomed in window if you want to get fancy.

Categories