On Sep 10, 6:18 pm, GG <[email protected]> wrote:
> holy $%!+ its working =)
> I had to move EVERYTHING into the load() function. The query_locations
> () and GDownloadUrl() need to be in there too. Dosnt that seem odd?
Then you have local versus global variables that aren't working the
way you want them to. I have a map that's configured with the various
options like so:
load() {
....
getMarkers()
....
};
getMarkers() {
GDownloadUrl("data.xml", function(data) {
....
var marker = createMarker( ... )
....
}
);
}
createMarker() {
....
var marker = new GMarker( ... );
....
return marker;
}
As you can see I don't have them inside of my main load() function.
> So 2 things I need to do now.
> 1) Prevent it from drawing a marker that it has already drawn (that
> sounds painful)
Where's your data coming from? You're calling 'map_data.php', what
does that do? Does it poll a database? Does it read in a physical
XML file? It's so much easier if you're using a database, say MySQL.
Picture this schema:
id INT (5) // up to 99999
lat FLOAT(10,6) // -999.999999
lng FLOAT(10,6) // -999.999999
visible int(1) // 1 or 0
When you do a map.addOverlay(marker), you can instantly update your
database and set visible=1. If someone moves the map just a tiny bit
and your query_locations() goes out and gatheres markers, you can
check the database and see whether a particular marker is already
visible (1) or not (0). I think you get the idea here ...
> 2) Execute a GDownloadUrl() one time on page load (after that
> query_locations() handles it)
Again, if it's a function by itself, you can call it whenever you
want. In my example above, I call it by means of another function
(getMarkers()) but I could just as well call it from anywhere I need/
want to.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---