Google会映射图像叠加和多色标记 - 如何组合代码?

时间:2015-06-16 08:02:59

标签: javascript google-maps google-maps-api-3

我有两个示例代码:

  1. 地图:https://drive.google.com/file/d/0B6Pit3BhPYj4Y0xjMnNabXRicTg/view

  2. 标记:https://drive.google.com/file/d/0B6Pit3BhPYj4Z2x5TElQb25kcHc/view

  3. 我想要做的是将标记(从文件2)放到地图上(1)(具有重叠图像)。

    有谁知道怎么做?

1 个答案:

答案 0 :(得分:0)

回答这个问题:Change marker icon with matching id

var marker_new = new Array();
var url = "";
switch (marker.id){
   case 1: break;
   case 2: break;
   case 3:url = "http://exampl.com/yellow.png";   
   case 4: break;
   case 5: break;    
}
marker_new[i] = google.maps.Marker({
                                 icon: url;
                                 position: place.geometry.location,
                                 map: map
                               });

<强>更新 例如:http://jsfiddle.net/uL2Lshu6/7/