2010-08-18 46 views
1

我有一個零售商和他們的標誌列表,我想要做的是在谷歌地圖上顯示它們。我認爲它的目的是展示我們市場覆蓋的擴展。在谷歌地圖中顯示零售商

我想要做的是能夠添加標記,但是當我點擊它們時,我想將對話框中的文本替換爲我自己的文本,並且還插入該位置的零售商徽標。

這可能嗎?如果有人對我如何去做這件事有任何建議,那也是太棒了。

+0

我不認爲它與js/html/css有關。您可以在谷歌地圖上修改這些信息,在「我的地圖」下(如果您已經保存了這些信息),然後您可以使用自定義名稱,圖標等對其中的任何人進行編輯。http://maps.google.com/support/bin/ static.py?page=guide.cs&guide=21670&topic=21676&answer=144365 – Sotiris 2010-08-18 12:08:53

回答

1

這當然是可能的。首先您需要做的是使用Google Geocoding service將您的零售商列表(我假設您有地址)轉換爲經緯度和零售商列表。

一旦你有一個緯度,爲您的零售商經度信息您可以爲每一個google.maps.marker對象並將其連接到一個google.maps.Map對象:

var myLatlng = new google.maps.LatLng(-25.363882,131.044922); 
var myOptions = { 
    zoom: 4, 
    center: myLatlng, 
    mapTypeId: google.maps.MapTypeId.ROADMAP 
} 

// where map_canvas is the id of a div that will contain the map on your page 
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); 

// for each of your retailers 
{ 
    var retailerLocation = new google.maps.LatLng(-25.363882,131.044922); 
    var retailerMarker = new google.maps.Marker({ 
     position: retailerLocation , 
     map: map, 
     title:retailerName 
    }); 
} 

您可以在每個retailerMarkers和顯示處理click event一個google.maps.InfoWindow與適當的內容(您可以控制的InfoWindow的內容,就像你的任何其他一塊你的網絡用戶界面一樣)。

+0

好像是我在找的東西!非常感謝:) – 109221793 2010-08-18 19:38:57

+0

@TaraWalsh沒問題。很高興這是有用的:) – RedBlueThing 2010-08-18 22:03:32