मैं एक ही नक्शे पर स्थापित करने के लिए 4 जहाजों है, इसलिए मैं गूगल डेवलपर्स उदाहरण का उपयोग और फिर इसे मुड़
https://developers.google.com/maps/documentation/javascript/examples/icon-complex
समारोह में bellow मैं 3 सेट अधिक रंग विकल्प:
function setMarkers(map, locations) {
...
var image = {
url: 'img/bullet_amarelo.png',
// This marker is 20 pixels wide by 32 pixels tall.
size: new google.maps.Size(40, 40),
// The origin for this image is 0,0.
origin: new google.maps.Point(0,0),
// The anchor for this image is the base of the flagpole at 0,32.
anchor: new google.maps.Point(0, 40)
};
var image1 = {
url: 'img/bullet_azul.png',
// This marker is 20 pixels wide by 32 pixels tall.
size: new google.maps.Size(40, 40),
// The origin for this image is 0,0.
origin: new google.maps.Point(0,0),
// The anchor for this image is the base of the flagpole at 0,32.
anchor: new google.maps.Point(0, 40)
};
var image2 = {
url: 'img/bullet_vermelho.png',
// This marker is 20 pixels wide by 32 pixels tall.
size: new google.maps.Size(40, 40),
// The origin for this image is 0,0.
origin: new google.maps.Point(0,0),
// The anchor for this image is the base of the flagpole at 0,32.
anchor: new google.maps.Point(0, 40)
};
var image3 = {
url: 'img/bullet_verde.png',
// This marker is 20 pixels wide by 32 pixels tall.
size: new google.maps.Size(40, 40),
// The origin for this image is 0,0.
origin: new google.maps.Point(0,0),
// The anchor for this image is the base of the flagpole at 0,32.
anchor: new google.maps.Point(0, 40)
};
...
}
एन के लिए में घ bellow मैं हर जहाज के लिए एक रंग सेट:
for (var i = 0; i < locations.length; i++) {
...
if (i==0) var imageV=image;
if (i==1) var imageV=image1;
if (i==2) var imageV=image2;
if (i==3) var imageV=image3;
...
# remember to change icon: image to icon: imageV
}
अंतिम परिणाम:
http://www.mercosul-line.com.br/site/teste.html
आपको बहुत बहुत धन्यवाद :) इस मैं के लिए :) मुझे पता कर सकते हैं क्या देख रहा था है, मैं जगह के अंदर इस पर लागू करते हैं जहां मैं मार्कर का दृष्टांत के रूप में मैं इस शो ve या इसे अलग से बाहर परिभाषित किया गया है? :) –
दोनों काम करते हैं। या तो आप 'आइकन' विशेषता जोड़ सकते हैं और इसे सेट कर सकते हैं, या 'setIcon' का उपयोग कर सकते हैं। मैं इसके बारे में नोट जोड़ दूंगा। – jsalonen
मदद के लिए बहुत बहुत धन्यवाद :) –