dom walking network links

93 views
Skip to first unread message

Jerry

unread,
Aug 30, 2009, 5:09:44 PM8/30/09
to KML Developer Support - Google Earth Plug-in
I am using the GE plugin dom.walk function. This function does exactly
what I need with one exception. I am using NetworkLinks and it seems
that this function will not visit features loaded via a NetworkLink. I
need to be able to find placemarks loaded via a NetworkLink. Can it be
done and if so, how? Thanks! Jerry

Roman N

unread,
Sep 1, 2009, 4:28:59 AM9/1/09
to KML Developer Support - Google Earth Plug-in
Hi Jerry,

Not natively, as KmlNetworkLink doesn't have a GEFeatureContainer.
Here's a relevant issue in the issue tracker that you can vote on and
sign up for email notifications:

http://code.google.com/p/earth-api-samples/issues/detail?id=260

One workaround is to use fetchKml on the network link's href and
continue your DOM traversal in the fetchKml callback. The dom.walk
method doesn't implement this directly, but you can still use it as
part of the solution. Although the traversal would have to become
asynchronous, as fetchKml is asynchronous.

Hope that helps,
Roman

Jerry

unread,
Sep 2, 2009, 12:09:36 PM9/2/09
to KML Developer Support - Google Earth Plug-in
Thanks Roman!

If I do a fetchKml on the href, would that create a second instance of
the same node? I want to be able to lookup a kml node fetched via
NetworkLink and fly to it for example. If the DOM I am searching is a
second copy I assume that would not work, right? The option I am
trying at the moment is to implement my own pseudo-NetworkLink where I
fetch the kml and then fetch change records and process each change in
javascript. It is lots of work but as best I can tell it will get me
what I want. The stretch goal is to use a server push to push the
changes as they occur.

I am using the same format as the NetworkLinkControl update syntax so
if and when I can access the NetworkLink nodes I can always switch
back without too much trouble.

Jerry

Roman N

unread,
Sep 5, 2009, 2:19:44 PM9/5/09
to KML Developer Support - Google Earth Plug-in
Hi Jerry,

It is a second instance, correct; how are you doing feature flytos?

Thanks,
Roman

Jerry

unread,
Sep 10, 2009, 7:35:23 PM9/10/09
to KML Developer Support - Google Earth Plug-in
Roman,

I am creating a tree in dojo from a JSON feed coming from the server
that contains a reference id. Then I fetch the kml and appendchild.
The kml uses the same reference id. I use walkdom to find the kml node
for that id and fly to it. If I use network links then the walkdom
does not walk the networklink kml and thus won't work for my
application.

My application is a simulation server that holds ground truth for
where the objects are. I want to be able to get an initial snapshot
and then make delta changes after that since the server may have many
thousands of objects. Network link seems just the ticket except for
the aformentioned problem. At this point in time I am implementing my
own delta update code but it is kind of a pain in the ***.

I did have an idea that I want to try though. What if I use parsekml
on just the change portion the network link? That way I could fetch
the change kml, run it through parsekml and thereby maintain
visibility to the kml features while changes are still processed by
the plugin. Is there any reason that would not work?

Thanks!

Jerry
> > > > done and if so, how? Thanks! Jerry- Hide quoted text -
>
> - Show quoted text -

Roman N

unread,
Sep 18, 2009, 5:42:29 PM9/18/09
to KML Developer Support - Google Earth Plug-in
Hi Jerry,

parseKml won't give you access to the Change elements because the
Earth API doesn't currently support NetworkLinkControl (i.e. there is
no interface named KmlNetworkLinkControl or KmlUpdate or KmlChange).
However, you can certainly use the browser's native XML parsing
capabilities to manually process NetworkLinkControls--it's just more
of a hassle.

Thanks,
Roman

TMAX

unread,
Sep 22, 2009, 5:03:18 PM9/22/09
to KML Developer Support - Google Earth Plug-in
Roman,

Any examples of XML parsing? OR

I am trying to do the same thing. What really SUCKS and why we are
having this issue is you can't do this in a KML description:

<a href="#" onclick="javascript:opensearch()">Open Search</a> The
"onclick" is stripped out... So we have to traverse all placemarks
because of this and add htmlballoons... (This i working on searches)



BUT:

The Network link we have loads placemarks on the fly and as you move
the map more placemarks come in. But the balloons are default
balloons, so all onclick events are stripped out...

Any suggestions? Anyone??

Can we traverse Network links placemarks? OR BETTER YET, have default
balloons NOT strip out the "onclick" events...

Thanks!

The site we are working on is:

www.earthplat.com/epapp/login.aspx (you will have to signup for a free
account...)

On Sep 18, 5:42 pm, Roman N wrote:
> Hi Jerry,
>
> parseKml won't give you access to the Change elements because the
> Earth API doesn't currently support NetworkLinkControl (i.e. there is
> no interface named KmlNetworkLinkControl or KmlUpdate or KmlChange).
> However, you can certainly use the browser's native XML parsing
> capabilities to manually process NetworkLinkControls--it's just more
> of a hassle.
>
> Thanks,
> Roman
>
> On Sep 10, 4:35 pm, Jerry wrote:
>
> > Roman,
>
> > I am creating a tree in dojo from a JSON feed coming from the server
> > that contains a reference id. Then I fetch the kml and appendchild.
> > The kml uses the same reference id. I use walkdom to find the kml node
> > for that id and fly to it. If I usenetworklinks then the walkdom
> > does not walk the networklink kml and thus won't work for my
> > application.
>
> > My application is a simulation server that holds ground truth for
> > where the objects are. I want to be able to get an initial snapshot
> > and then make delta changes after that since the server may have many
> > thousands of objects.Networklinkseems just the ticket except for
> > the aformentioned problem. At this point in time I am implementing my
> > own delta update code but it is kind of a pain in the ***.
>
> > I did have an idea that I want to try though. What if I use parsekml
> > on just the change portion thenetworklink? That way I could fetch
> > > > > One workaround is to use fetchKml on thenetworklink'shref and

TMAX

unread,
Sep 22, 2009, 5:08:44 PM9/22/09
to KML Developer Support - Google Earth Plug-in
I am trying to do the same thing. What really SUCKS and why we are
having this issue is you can't do this in a KML description:

<a href="#" onclick="javascript:opensearch()">Open Search</a> The
"onclick" is stripped out... So we have to traverse all placemarks
because of this and add htmlballoons... (This i working on searches)

BUT:

The Network link we have loads placemarks on the fly and as you move
the map more placemarks come in. But the balloons are default
balloons, so all onclick events are stripped out...

Any suggestions? Anyone??

Can we traverse Network links placemarks? OR BETTER YET, have default
balloons NOT strip out the "onclick" events...

Thanks!

The site we are working on is:

www.earthplat.com/epapp/login.aspx (you will have to signup for a free
account...)

Roman N

unread,
Sep 25, 2009, 7:38:07 PM9/25/09
to KML Developer Support - Google Earth Plug-in
Hi, one workaround is to set a click listener on the network link or
containing document itself. That listener should be called when
contained placemarks are clicked, due to event bubbling. In the
listener, you can create a custom balloon with custom JavaScript.

Hope that helps,
Roman

On Sep 22, 2:08 pm, TMAX wrote:
> I am trying to do the same thing. What really SUCKS and why we are
> having this issue is you can't do this in a KML description:
>
> <a href="#" onclick="javascript:opensearch()">Open Search</a> The
> "onclick" is stripped out... So we have to traverse all placemarks
> because of this and add htmlballoons... (This i working on searches)
>
> BUT:
>
> The Network link we have loads placemarks on the fly and as you move
> the map more placemarks come in. But the balloons are default
> balloons, so all onclick events are stripped out...
>
> Any suggestions? Anyone??
>
> Can we traverse Network links placemarks? OR BETTER YET, have default
> balloons NOT strip out the "onclick" events...
>
> Thanks!
>
> The site we are working on is:
>
> www.earthplat.com/epapp/login.aspx(you will have to signup for a free

Rob Mastronicola

unread,
Apr 29, 2013, 12:42:16 PM4/29/13
to google-earth-...@googlegroups.com
Does anyone have working code that does this? I'm hoping someone has figured out how to traverse and display network link contents.
Reply all
Reply to author
Forward
0 new messages