2011-01-20 137 views
2

我一直在使用優秀的$GoMap jquery plugin,它基本上是谷歌地圖API V3的包裝。它爲我提供了很好的服務,但是當使用大量標記60+時,似乎存在一些性能問題,所以我決定是時候直接使用V3 API了。Google Maps API V3:多標記和ajax信息導入? (最佳性能)

我已經閱讀了一些初學者教程,但是考慮到我在演奏之後我想讓您的想法/片段成爲在V3 API中實現以下原生效果的最有效方式......(但是,對於60 +標記)

$(function() { 
    $("#map").goMap({ 
     maptype: 'ROADMAP', 
     mapTypeControl: false, 
     zoom: 9, 
     markers: [  { 
      latitude: 52.941364, 
      longitude: 0.648730,   
      html: { 
       content: '<img src="http://localhost/gv2010/user_area/assets/js/carousel/loader.gif"/>', 
       ajax: 'http://localhost/gv2010/maptest/ajax/gmap_window.php?job_id=4002&img=40%2Fj4002_i2523&name=B%26b+With+Tlc&village=Brancaster&url_str=bandbwithtlc&rooms_num=&sleeps_text=' 
      } 
     },    { 
      latitude: 52.963097, 
      longitude: 0.742940,   
      html: { 
       content: '<img src="http://localhost/gv2010/user_area/assets/js/carousel/loader.gif"/>', 
       ajax: 'http://localhost/gv2010/maptest/ajax/gmap_window.php?job_id=4003&img=40%2Fj4003_i2358&name=Scolt+Cottage&village=Burnham+Overy+Staithe&url_str=scoltcottage&rooms_num=&sleeps_text=' 
      } 
     },    { 
      latitude: 52.904720, 
      longitude: 0.623171,   
      html: { 
       content: '<img src="http://localhost/gv2010/user_area/assets/js/carousel/loader.gif"/>', 
       ajax: 'http://localhost/gv2010/maptest/ajax/gmap_window.php?job_id=4200&img=42%2Fj4200_i4599&name=1+Ringers+Cottage&village=Docking&url_str=1-ringers-cottage&rooms_num=&sleeps_text=' 
      } 
     } 
     ], 
     icon: 'map_marker.png'   
    }); 
}); 

任何幫助非常感激

+0

更新:好吧,事實證明它是FireBug造成的性能問題,仍然真的熱衷於翻譯成本地谷歌地圖,如果任何人都可以幫助 – Haroldo 2011-01-20 11:58:33

回答

0

如何使用marker clusterer?檢查this speed test第一。 另請查詢this answer瞭解如何直接使用Google Maps API的示例代碼。

+0

是的,我看了很多集羣工具,但我不是準備開始做羣集,直到我有我本來的API V3中的東西。 - 我不確定的是如何做ajax信息窗口? – Haroldo 2011-01-20 12:14:45