I´m trying to associate a image to 15 different teams markers on Google Maps, I´ve trying to do it, but it´s not working properly on my map, any suggestion will be appreciated. My idea is associate: if(location.nombreequipo==AST1){ icon: imagen } but I have many doubts about this idea.
function displayLocation(location){
var content = '<strong><p>Equipo: ' +location.nombreequipo + '</strong>'
+'</strong></p><strong><p>Hora móvil: ' + location.fecha_movil
+ '</strong></p><strong><p>Longitud: ' +location.longitud +'</strong></p>'
+ '</strong></p><strong><p>Latitud: ' +location.latitud +'</strong></p>';
var latLng = new google.maps.LatLng(parseFloat(location.latitud), parseFloat(location.longitud));
var imagen ='img/blue_MarkerA.png';
var marker = new google.maps.Marker({
position: latLng,
draggable: false,
map: map,
draggable: true,
visible: true,
title: location.nombreequipo
});
arrayMarcadores.push(marker);
google.maps.event.addListener(marker, 'click', function(){
infowindow.setContent(content);
infowindow.open(map, marker);
});
return marker;
}
Thanks in advance.
Can you try adding a
.imagenproperty to yourlocation?For example, assign
location.imagen = img/blue.png, thenBy the way you have two
draggable, first false, then true.