Has anyone got suggestions how to populate a map with markers as MastaBaba last posted BUT instead of removing all existing markers and then drawing all markers that the databse query returns, instead only draw NEW markers and have an algorythm for which (old) markers to remove?
I'm thinking about creating such a map and was thinking to maintain an array of id's for each drawn marker. The database query returns a unique id for each marker - if that marker is already drawn then don't waste resources by removing and then re-drawing it. After each database query has been processed check the toal number of markers on the map, if it exceeds a number (defined in the map code but presumably around the 200 limit) then prune all markers starting with those furthest from the map center until there are not more markers on the map than set by the limit. Haven't started working on this yet but hope to find time soon. Martin. On 25 Sep, 10:18, MastaBaba <[EMAIL PROTECTED]> wrote: > Oh, that wasn't too hard. This is what you need to do before loading > your file: > > var center = map.getCenter(); > var span = map.getBounds().toSpan(); > > var centreLat = center.y; > var centreLng = center.x; > var spanLat = span.y; > var spanLng = span.x; > > var url = > "marker_input.php?lat="+centreLat+"&lng="+centreLng > +"&spanlat="+spanLat+"&spanlng="+spanLng; > > Then in the script which picks up the points from the database, derive > the 'box' from which you return points by using the centre and span > values. > > Greets, > > Babak Fakhamzadeh > > On Sep 25, 3:44 pm, MastaBaba <[EMAIL PROTECTED]> wrote: > > > Hiya, > > > That works for only showingmarkersat a certain distance from the > > center of the viewed map. > > > But what if you want to pick up allmarkerswithin the map window? > > You'd need to pass on the boundary of the mapwindow to the file which > > returns themarkers. Something like map.getbounds(), if it exists. > > Thing is, I can't find the appropriate function for this. Any ideas? > > > Greetings, > > > Babak Fakhamzadeh > > > On Sep 23, 5:17 pm, Swanson <[EMAIL PROTECTED]> wrote: > > > > Your best bet would be to have all themarkersstored in a Mysql > > > Database, and then create a PHP file which loads thesemarkersbased > > > on a radius using the centerpoint of your map. > > > > I've written this example, which is largely based on code i've found > > > around here which might > > > help:http://www.swansoninternet.com/content/view/30/28/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
