managing marker data in js
So trying to figureout the best way to manage marker data in a map
engine.
There are a couple of strategies I have already employed (this is
background for my q):
1. Any marker that is to be displayed must belong to a marker set
2. Any marker can belong to any number of sets.
3. Each marker has a marker id and a set id
ok, that said, right now I load all marker data coming out of the
database into an array in javascript (note that I do not make XML
requests to get the data up to the page). Basically I dynamically
generate the js array in php:
MData[] - all Marker stuff
Each array object is then itself an array with several properties, like
lat, lon, title, html, label, etc, all populated by php.
Then when I inititialize the map I also inititialize the markers.
THE QUESTION:
Where to stick the Marker references in the js during marker
construction, since I assume I want to be able to reference each marker
later?
Do I create new arrays, something like:
MArray[n] = new GMarker(mypoint);
Should then also duplicate all the data to this new array for easy
referencing (this sort of makes sense for easier referencing later, but
also seems sooo redundant), like:
MArray[n].lat = MData[n].lat
MArray[n].html = MData[n].html
But maybe I should just assign the marker reference to the first array,
maybe like:
MData[n].marker = new GMarker(mypoint);
Not sure what the consequences of either methodoligy might be or if
there is a better one, so I ask for your thoughts. (thanks in advance
for your input of course!)
0 Comments:
Yorum Gönder
<< Home