How to optimize loading of markers on GMap v3 map?
I'd like to know what is the best way to refresh markers on a GMap v3 map.
Basically, here is what I have :
I get all the stores located in the part of the map displayed at screen
with a stored procedure.
In JavaScript, I put them in an array.
A JavaScript method put markers on the map based on this array.
Each time the user moves on the map, the stored procedure will be called
and the JavaScript array will have new stores (ie new markers) to display.
I need to fully optimize this operation, and JavaScript is not my favorite
language.
So, each time the stored produre is call, what is the best way to do this :
Delete all markers on the map and recreate them ?
Get the result of the SP, and for each location, look in my array if the
location is already on the map and add only the ones which are not still
on the map ? (But I'm afraid the array became very very large after 10 or
20 minutes moving on the map)
Get the result of the SP, and for each location, look in my array if the
location is already on the map, add only the ones which are not still on
the map and delete the ones which are no longer on the map ?
Any other solution ?
Thank you !
No comments:
Post a Comment