Hi Panagiotis,
Glad you solved it..
1 That's not good way to show it all. More preferable is to use infowindow on marker click with information you need.
Here is an example how to use it:
pre
Code: Select all
//Were "multiGoogleMap" is map component name.
var map = Appery("multiGoogleMap").options.mapElement.gmap('get', 'map');
//Create infowindow.
var infowindow = new google.maps.InfoWindow({
content: 'test content',
maxWidth: 320
});
Code: Select all
var CreateMarker = function(data){
var marker = new google.maps.Marker({
position: new google.maps.LatLng(data.lat, data.long),
map: map,
draggable: true,
title: data.location
});
//Add event handler and open infoWindow
google.maps.event.addListener(marker, 'click', function() {
//Set content for infowindow.
infowindow.setContent('Content of + ' + data.location + '');
//Open infowindow.
infowindow.open(map, marker);
});
};
for (var i = 0; i < locationHelper.aLocations.length; i++)
//In this function you should to pass latitude, longitude and text to display in infowindow.
CreateMarker({lat: locationHelper.aLocations[i][0], long: locationHelper.aLocations[i][1], location: locationHelper.aLocations[i][2]});
/pre
2 Unfortunatly there is no way to clear all overlays without handle them.
But when you have this items (which you want to remove from map) you can remove them with ".setMap(null);" method.
See details details about implementation:
http://stackoverflow.com/questions/15...
So with this implementation when you add marker you need invoke:
pre
markersArray.push(marker);
/pre
And when you need remove all markers you can run following JS:
pre
clearOverlays();
/pre
Regards.