2013-12-12 19 views
1

在谷歌地圖如何能在地圖上,而不是一般的weput的號碼(如果列出的圖標倍數是指數量的遞增像1,2,3)如何將數字放在地圖上而不是通用標記?

,而不是

var iconBlue = new GIcon(); 
iconBlue.image = 'http://labs.google.com/ridefinder/images/mm_20_blue.png'; 
iconBlue.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'; 
iconBlue.iconSize = new GSize(12, 20); 
iconBlue.shadowSize = new GSize(22, 20); 
iconBlue.iconAnchor = new GPoint(6, 20); 
iconBlue.infoWindowAnchor = new GPoint(5, 1); 

這是可能的谷歌地圖 ??? 這裏我發現了一些鏈接,但它不工作。

+1

您正在使用過時的(和關閉)[Gooogle企業地圖JavaScript API第2]( https://developers.google.com/maps/documentation/javascript/v2/reference)。新代碼應該在[當前活動的v3](https://developers.google.com/maps/documentation/javascript/tutorial)中開發, – geocodezip

回答

0

目前的API(v3)無法做到 - 但您可以使用StyledMarker Library。它擴展了類,並允許您設置圖標的樣式並在圖標內放置文本(如果您想要的話)(這是我相信您在尋找的內容)。只需將腳本包含在應用程序中(加載Maps API腳本後)即可。然後添加StyledMarker,就像您經常對象:

var styleMaker1 = new StyledMarker({ 
    styleIcon: new StyledIcon(StyledIconTypes.MARKER, { 
     color: "FFFFFF", 
     text: "1" //this is where you'll set your incremented value 
    }), 
    position: myLatLng, 
    map: map 
}); 

下面是它的外觀十分硬朗:http://jsfiddle.net/svigna/7L2wY/

相關問題