how to make a dynamic GE plug-in programming

15 views
Skip to first unread message

yangqch

unread,
Jun 30, 2009, 1:02:24 AM6/30/09
to KML Developer Support - Google Earth Plug-in
sorry for the general title.
My goal is to use c# and ASP.net frame to show local traffic
information on GE by web page. So I have to choose GE plug-in.
The program will download data from server every 10 seconds(because
the data on sever is updated every 10s). And then process the data to
get a group of points with three attributes: latitude, longitude and
value of traffic speed. This part is ok.
Then I wanna show all the points on GE(use different color to present
the value of speed).
I see GE Plug-in can only be coded by JavaScript, so my problem is how
to deliver the data from C# to JavaScript?
And another problem is my data is updated every 10s, so the GE should
also be changed every 10s, and I don't want the page to "onload" every
time. What kind of method should I use?

Thanks!

StarTraX

unread,
Jun 30, 2009, 7:32:09 AM6/30/09
to KML Developer Support - Google Earth Plug-in
I have had a lot of success using the .NET webBrowser class in which I
generate JScript functions which interface with geplugin ojects at run-
time and use the webBrowser.invokeScript method to execute the JS
functions.

yangqch

unread,
Jun 30, 2009, 1:00:50 PM6/30/09
to KML Developer Support - Google Earth Plug-in
could u tell some details? I am a beginning of .Net programming.
I don't know how to update JScript without reloading the web page.

StarTraX

unread,
Jul 1, 2009, 6:43:16 AM7/1/09
to KML Developer Support - Google Earth Plug-in
You have to create the JS functions in the WebBrowser by creating the
text in a string (S in my case) and then assigning the string to
webBrowser.documentText
in the string you define the JS functions like
S += " function jsGetVersion() {"
' Return the version of geplugin
S += " return(ge.getEarthVersion() + ' GeAPIVersion: ' +
ge.getApiVersion() );"
S += " }" & vbCrLf
then:
WebBrowser1.DocumentText = S

and you can then call the function with
webObj(0) = WebBrowser1.Document.InvokeScript
("jsGetVersion", webObj)

You're not re-loading the web page, but executing JS functionms within
the web page.
If you're new to .NET then there's a pretty steep learning curve
ahead. But it's worth it
Reply all
Reply to author
Forward
0 new messages