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.
Related
So I have a probably not so unique scenario. The simplest way to explain it is a google map with all 50 US states, each state will have two markers. The markers are both driven by the same lat/long value. The problem Im having is that the markers are rendering ontop of one another. I somehow need to have them render next to one another or offset so that I can see both. The problem is how do I get it to not overlap into another state.
I saw some really neat "spider" functionality where it renders one marker and then if you click on it the others fan out, but the website was in another language.
I am going to try and use the following library.
https://github.com/jawj/OverlappingMarkerSpiderfier
The problem with the above implementation is that I am using a combination of KML and google maps client-side. I dont see a way to implement that for the kml markers
The Overlapping Marker Spiderfier project on GitHub will probably accomplish what you need.
Otherwise you can play around with the Marker's icon property. The icon can accept a Symbol which has and anchor that can be shifted from the default location (0,0).
Symbol documentation: https://developers.google.com/maps/documentation/javascript/reference#Symbol
I have a map application that can be seen here:
http://chrismcaleenan.com/map/?page_id=25
Each of the Malaysian states in the application will have an InfoWindow that displays additional information. You can see an example of this by mousing over 'Kedah' either in the main data table on the right or on the state itself in the map.
The problem, as you can see, is that the map pans in order to position the InfoWindow. Is there a way to fix the map position and set the InfoWindow size or position so that it is fully displayed without panning? In the Kedah example, one could have the InfoWindow positioned directly to the right and/or use a shorter tail.
One option would be to create a custom graphic for each state, but I'd rather avoid this as I will be running into the same issue with add'l data (e.g. click Kedah to zoom - will have InfoWindows on all data points on zoom).
If you're playing around double-clicking the water will zoom back out and reset map.
Thanks!
Yes, and sometimes the pan pulls the mouse outside of the state, which causes the InfoWindow to disappear. I know that's not what you want. The Google Maps demo catalog includes a sample that I think will give you what you want for your map. It's named SmartInfoWindow. Take a look, click on some of the markers, check out how the SmartInfoWindow behaves, and see if that might help you achieve what you want. It's not perfect, but it keeps the pan at the absolute minimum.
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);
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..
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.