简体   繁体   中英

Google Maps API V3 : multiple markers and ajax infowindows? (best performance)

I've been using the excellent $GoMap jquery plugin which is basically a wrapper for google maps API V3. It has served me well but when using lots of markers 60+ there seem to be some performance issues, so i've decided it's time to use the V3 API directly.

I've read a fair few beginners tutorials but considerring I'm after performance I'd like to get your thoughts/snippets the most efficient way of achieving the following natively in the V3 API...(but for 60+ markers)

$(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'        
    }); 
}); 

any help really appreciated

How about using the marker clusterer ?Check this speed test first. Also please check this answer for some sample code of how you can use the google maps api directly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM