Hi Tristan,
If you were to store your point data in a database instead of in
kml, you could manipulate it on the fly. See
http://gaialab.asu.edu/exoplanets
for an example. The very long list of planets is loaded up by a very
short php routine that writes the javascript dynamically into the
loadPlanets function. You could set up all the different icons as the
example shows, and then assign them based on the contents of one of
the table columns (in the example, I use the star's main spectral type
as the icon determinate, and I've set up the style maps with the same
names as the values in the table column, so it's a breeze. If you did
something similar, you could change them at will. Note that the
example also uses Ajax calls to load the top and right hand divs on
the page with information when the user clicks a star icon on the
map. It's deceptively simple to do with the loadAjax function and a
very short php program that fetches and formats the data on the
server, then sends it back to the browser.
-Steve
On Aug 25, 10:35 pm, tristan wrote:
> hello,
>
> I'm loading a series of networklinks, and each contains several dozen
> placemarks.
>
> What I'd like to do is be able to modify the placemarks from within
> the API, changing their icon styles and such.
>
> KmlFolder's have the getFeatures() member, but networklinks do not
> possess such a thing.
>
> this is a spinoff of a function from fraser in another thread, seems
> to be a good way to check what's going on...
> --------------------------------------------------------------------------------------------
> function regionKml() {
> var node = ge.getFeatures().getFirstChild();
>
> function traverseKml(node) {
> if(node.getFeatures().hasChildNodes()) {
> var subNodes = node.getFeatures().getChildNodes();
> var length = subNodes.getLength();
> for(var i = 0; i < length; i++) {
> var eachSubNode = subNodes.item(i);
> var nodeType = eachSubNode.getType();
> var nodeName = eachSubNode.getName();
> var nodeID = eachSubNode.getId();
> switch(nodeType) {
> case 'KmlNetworkLink' :
> alert(eachSubNode.getKml())
> break;
> case 'KmlFolder' :
> traverseKml(eachSubNode);
> break;
> }
> }
> }
> }
> traverseKml(node);}
>
> --------------------------------------------------------------------------------------------
> unfortunately, it seems the furthest I can go into those networklinks
> is to go:
> networklink.getLink().getHref()
> but that's not even close to the contents of the networklink...am I
> missing something here?
>
> The KML for one of these nwl's looks like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <kml xmlns="
http://earth.google.com/kml/2.2">
> <NetworkLink id="1">
> <name>North America</name>
> <Camera id="1">
> blah blah...
> </Camera>
> <Region id="1">
> blah blah...
> </Region>
> <Link id="1">
> <href>
http://www.[URLto a bunch of placemarks].kml</href>