2011-05-20 63 views
-1

我們在一年前完成了此腳本,並且不顯示標記圖標。我知道它的gmap 2,現在應該是gmap3 ..但是對於我的生活無法轉換。任何幫助表示讚賞,或幫助我們解決這個問題,請。谷歌地圖自定義標記不顯示

腳本是:

var userLocation = '<?php echo $homelocation; ?>'; 

if (GBrowserIsCompatible()) { 
    var geocoder = new GClientGeocoder(); 
    geocoder.getLocations(userLocation, function (locations) {   
     if (locations.Placemark) 
     { 
     var north = locations.Placemark[0].ExtendedData.LatLonBox.north; 
     var south = locations.Placemark[0].ExtendedData.LatLonBox.south; 
     var east = locations.Placemark[0].ExtendedData.LatLonBox.east; 
     var west = locations.Placemark[0].ExtendedData.LatLonBox.west; 

     var bounds = new GLatLngBounds(new GLatLng(south, west), 
             new GLatLng(north, east)); 

     var map = new GMap2(document.getElementById("map_canvas")); 

      var Icon = new GIcon(); 
      Icon.image = "images/422marker.png"; 
      Icon.iconSize = new GSize(33, 50); 

     map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds)); 
     map.addOverlay(new GMarker(bounds.getCenter()), Icon); 
     } 
    }); 
} 
+0

你將不得不重寫大部分內容,沒有辦法繞過它,你將不得不去閱讀和研究文檔和例子 - 這很清楚。也加入Gmaps v3 Google Group。 – Cups 2011-05-20 13:17:15

+0

它曾經工作過,但不再?或者標記不工作? – Trott 2011-05-20 14:35:52

+0

它實際上是完美的,只是不顯示我們的自定義標記。 – 422 2011-05-21 01:02:18

回答

0

是否&v=2出現在加載從谷歌API的裝載腳本網址是什麼?如果沒有,請添加它,腳本可能會重新開始工作。

當然,您仍然需要花些時間升級到v3。

+0

是的版本出現在腳本中,它只是不顯示的自定義標記,我們繼續得到stardard標記引腳。 – 422 2011-05-21 01:03:04

+0

自定義標記是否曾用過v2腳本?或者這是你最近才添加的和/或它從未工作過的東西? – Trott 2011-05-21 06:05:00

+0

,我不能確定哈哈。我只是通過我們所在網站的所有Google地圖腳本,並注意到這並不顯示自定義標記 – 422 2011-05-21 07:12:22