I'm using markerClusterer: http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererplus/docs/reference.html
and my problem is this:
The user, on the map can edit the icon of the markers.
So, I want that one marker's icon is changed, the cluster parent must recalculate the cluster icon.
Any ideas?
Thanks
Resolved.
The .CALCULATOR() function is recalled every time you zoom in and zoom out the map, so is automagically resolved.
Related
I am trying to filter my markers in my Here maps. I managed to hide my Noisemarkers on filter, but the weight of my clusterMarkers are still the same as before.
I was wondering if there is a way in Here maps to get the new weight of clusters after hiding some markers.
My current code is the following for hiding markers:
var markerHidden = getCorrectMarker(df.dealersArray[dealerNumberHidden], arrayOfMarkers);
if (markerHidden) {
markerHidden.setVisibility(false);
}
Is there a way to update all clusters on the map with only visible markers or not?
Visibility of marker can be set to False only at the map level, however at cluster level, no method defined for limiting the visibility.
Please refer API reference documentation of clustering:
https://developer.here.com/documentation/maps/topics_api/h-clustering-intro.html
I have a map that has markers programmatically placed on it based on values in my database. When you click on a marker, it will go to a detail page for that location.
My problem is that when the map is sufficiently zoomed out, markers that are close enough to each other appear as a single marker, in effect hiding some of the markers. Is there a way to tell programmatically whether a marker is part of a group of markers or is hidden/covered up by other markers?
My intention is to do something like this for each dynamically generated marker:
marker.addListener('click', function() {
// if marker is not hiding any other markers
window.location.href = markerURL;
// else if it is hiding markers/is part of a group of markers
map.setZoom(15);
map.setCenter(marker.getPosition());
});
I have checked the Marker API documentation, but can't seem to find any useful methods. getClickable and getVisible always return true in my case, regardless of whether a marker is covered by another marker. Any suggestions? Thank you!
I ended up going with MarkerClusterer to solve my problem. I was hoping for a simpler solution, but this turned out to be pretty simple after all.
The only thing I needed to add to my existing marker-generating code was a list: var markers = [];, and then I called markers.push(marker); on all of my markers. The final step was to create a new MarkerClusterer object:
var markerCluster = new MarkerClusterer(map, markers, options);
And MarkerClusterer handles the rest more or less (the options parameter is optional, but I used it to set the path to my images and set the maximum zoom level). Now, in the situations where previously my markers were stacked on top of each other, making it impossible to see or click certain markers at certain zoom levels, I instead see a cluster with a number indicating the number of markers in that cluster. Clicking the cluster icon will further zoom in, revealing my markers.
All of this was done following the simple usage example on their github page, but they have pretty good documentation too. Most of my time getting this to work right was actually spent styling the cluster icons to match my site's color scheme...
I'm using Marker Clusterer to display the amount of "markers" in an area in my Google Maps Web Application.
But: Every time a flag appears / disappears, it seems that the Clusterer gets completely redrawn instead of just updated the counter inside.
I understand this behaviour because of the different colors, sizes etc.
But what can i do to prevent this?
Do i have to prevent the different stylings so the Clusterer stays the "same", or what can i do to just update the number inside the circle?
I have thousands of markers, every one appears/and disappears, so i just want to have a steady circle with a number inside.
There is option nodraw which can be set to true and redraw won't be performed:
Adds a marker to the clusterer and redraws if needed:
addMarker(marker:google.maps.Marker, opt_nodraw:boolean)
Add an array of markers to the clusterer:
addMarkers(markers:Array.<google.maps.Marker>, opt_nodraw:boolean)
I have a list of google maps markers as html links next to a google map. I have the function that is triggered when I click on the link. Marker ID is passed to this function.
My question is - when I have 100 markers, I want somehow IDENTIFY the clicked marker on the map. Some sort of ripple effect that would go away from the marker.
please advice what are my possible options so I could develop appropriate solution
Example: 100 markers already on the map. I also have 100 names on the left. Each name corresponds to each marker. When I click the name, I want the marker that belongs to that name somehow "blink" or identify itself in some other way among other markers.
before the markers was pin on the map
you need to set a global markers variable
var gb.markers = [];
while you create each marker need to push into global marker array
marker = new google.maps.Marker({
// other stuff
'id': marker.id
});
after you done with assign function to marker, push it into global var
gb.markers.push(marker);
make sure when you click on marker will get marker id
and loop the global markers or make marker array with id as index
A ripple effect would be quite complicated, possibly involving positioning of a 'GroundOverlay' object centered around the marker you wish to highlight.
If your goal is just to be able to highlight the marker, perhaps playing a simple animation using 'Marker.setAnimation(animationObject)'. You could perhaps using 'Animation.BOUNCE' to highlight the marker?
I have an OpenLayers map object, and I have added markers to a layer, and added it to the map.
But how do I make sure all the markers are in the display area?
Thanks,
Gil
In order to display all markers on the map
Firstly,make sure you have all markers in one layer.
Secondly,you need to zoom to bound where all markers in marker layer are extended.
To do that,simply
var bounds = markerLayer.getDataExtent();
map.zoomToExtent(bounds);
//has a second parameter that decides to find closest zoom level
//default is false
Please check OpenLayers Document for Marker Layer
Best Regards
Myra