Google Maps V3: Only show markers in viewport - Clear markers issue

前端 未结 6 1195
再見小時候
再見小時候 2021-01-30 04:33

I like to create a map with Google Maps that can handle large amounts of markers (over 10.000). To not slow down the map I\'ve created a XML-file that only outputs the markers t

6条回答
  •  时光说笑
    2021-01-30 04:54

    Due to the following explanation using 'tilesloaded' or 'bounds_changed' would be very wrong and cause unwilling continuous firings. Instead you would want to use 'idle' event which will fire once the user has stopped panning/zooming.

    google.maps.event.addListener(map, 'idle', loadMapFromCurrentBounds);

    https://developers.google.com/maps/articles/toomanymarkers#viewportmarkermanagement

提交回复
热议问题