问题
i have 20 markers from which i want to show 10 markers with similar marker and with similar label ("A") , and other 10 i want to show with different marker image and different label ("B") . im getting all the marker with same image and same label
js fiddle https://jsfiddle.net/9yq8y1p2/4/
var initMap = function () {
var labels = '0123456789';
var labelIndex = 0;
var myLatLng = { lat: 17.446507, lng: 78.383033, deviceId: 'a' };
var citymap = {
hyderabad: {
center: { lat: 17.446507, lng: 78.383033 },
population: 5000
}
};
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 18,
center: myLatLng,
});
}
回答1:
var marker = new google.maps.Marker({
position: location,
icon: condition ? image_1 :image_2,
map: map
});
You can mention the condition for which you want image_1 as marker.
来源:https://stackoverflow.com/questions/44341194/how-to-change-the-marker-image-in-google-maps