Hello,
I state that I am not a clever programmer and I hope to get some help from you.
I am building a map with many departments and ClusterMarker is exactly what I need to have an ordered map. I should make some changes to the example:
Pratically, once I click on a marker, I would insert in the white box a description of the department with all the informations about it, as in the example in Fig.
--->
I have no problems for a description in html in the box, I just need to understand how to insert it using your example.
Have you got an existing working map - without ClusterMarker - that i can take a look at?
It's likely to be easier to add ClusterMarker to an existing working map than it would be to take the Demo Map example and change it to suit your needs.
If you have a map and can post the URL then please do - and if you'd rather not post the URL in the forum then just PM me the URL and i'll take a look.
martin wrote:
Hi Claudio and welcome to the forum.
Have you got an existing working map - without ClusterMarker - that i can take a look at?
It's likely to be easier to add ClusterMarker to an existing working map than it would be to take the Demo Map example and change it to suit your needs.
If you have a map and can post the URL then please do - and if you'd rather not post the URL in the forum then just PM me the URL and i'll take a look.
Thanks.
Martin.
Hello Martin,
now, I have solved this problem, but now I have another one.
I have modified the example http://googlemapsapi.martinpearman.co.uk/infusions/google_maps_api/basic_page.php?map_id=4
function myClusterClick(args) {
cluster.defaultClickAction=function(){
map.setCenter(args.clusterMarker.getLatLng(), map.getBoundsZoomLevel(args.clusterMarker.clusterGroupBounds))
delete cluster.defaultClickAction;
}
var html='<div style="height:8em; overflow:auto; width:24em"><h4>'+args.clusteredMarkers.length+' Locations:</h4>';
for (i=0; i<args.clusteredMarkers.length; i++) {
html+='<a href="javascript:cluster.triggerClick('+args.clusteredMarkers[i].index+'">'+args.clusteredMarkers[i].getTitle()+'</a><br />';
}
html+='<br /><a href="javascript:void(0)" onclick="cluster.defaultClickAction()">Zoom</a> in to show these locations</div>';
// args.clusterMarker.openInfoWindowHtml(html);
map.openInfoWindowHtml(args.clusterMarker.getLatLng(), html);
}
// create a ClusterMarker
cluster=new ClusterMarker(map, {markers:markersArray, clusterMarkerTitle:'Click to see info about %count locations' , clusterMarkerClick:myClusterClick });
cluster.fitMapToMarkers();
----------------------
the problem is that when I click on "Zoom in to show These locations", the balloon remains, as shown:
When I click "Zoom" in to show These locations" happens this:
martin wrote:
Hi Claudio and welcome to the forum.
Have you got an existing working map - without ClusterMarker - that i can take a look at?
It's likely to be easier to add ClusterMarker to an existing working map than it would be to take the Demo Map example and change it to suit your needs.
If you have a map and can post the URL then please do - and if you'd rather not post the URL in the forum then just PM me the URL and i'll take a look.
Thanks.
Martin.
Hello Martin,
now, I have solved this problem, but now I have another one.
I have modified the example http://googlemapsapi.martinpearman.co.uk/infusions/google_maps_api/basic_page.php?map_id=4
function myClusterClick(args) {
cluster.defaultClickAction=function(){
map.setCenter(args.clusterMarker.getLatLng(), map.getBoundsZoomLevel(args.clusterMarker.clusterGroupBounds))
delete cluster.defaultClickAction;
}
var html='<div style="height:8em; overflow:auto; width:24em"><h4>'+args.clusteredMarkers.length+' Locations:</h4>';
for (i=0; i<args.clusteredMarkers.length; i++) {
html+='<a href="javascript:cluster.triggerClick('+args.clusteredMarkers[i].index+'">'+args.clusteredMarkers[i].getTitle()+'</a><br />';
}
html+='<br /><a href="javascript:void(0)" onclick="cluster.defaultClickAction()">Zoom</a> in to show these locations</div>';
// args.clusterMarker.openInfoWindowHtml(html);
map.openInfoWindowHtml(args.clusterMarker.getLatLng(), html);
}
// create a ClusterMarker
cluster=new ClusterMarker(map, {markers:markersArray, clusterMarkerTitle:'Click to see info about %count locations' , clusterMarkerClick:myClusterClick });
cluster.fitMapToMarkers();
----------------------
the problem is that when I click on "Zoom in to show These locations", the balloon remains, as shown:
When I click "Zoom" in to show These locations" happens this:
The problem doesn't exist with the new and not yet released version 2 of ClusterMarker.
In the process of re-writing much of the code i made some improvements and now a cluster marker isn't removed from the map on every zoom or drag.
I'd encourage you to look at version 2 if you are reasonably competent with javascript.
I've been too busy so far this year to get the new version 2 completed, debugged and documented.
But if you choose to give it atry i'm sure you'll find it far superior to version 1.3.2 and if you have questions on how to use it then post in the forum and i'll do my best to help.
Martin.
PS i just noticed that you've solved the problem with an event listener closing the infowindow - if you're happy to use that then ok otherwise you might still want to check out the version 2.