开发者

Client-side Google Earth + JS; server-side Java package

I'm trying to wrap my head around the proper architecture for a demo app that uses Google Earth. I'd appreciate any suggestions, as I'm new to this!

The web page should:

  • display a Google Earth globe
  • a开发者_如何转开发llow for the user to select certain objects (KML) to be visible interactively (checkboxes, buttons etc)

What I have:

  • a Java package already written which produces the KML-data I want to use
  • a basic web page which embedds a Google Earth globe.

So, I guess the question is how to get the Java output into Google Earth. As GE's API is for Javascript, is there any way to call the Java-methods from there? Any other way to solve it?


You've got two options depending on how you want to serve up the kml.

A) You can set up a network link or use fetchkml with url that points to a servlet that gets kml from the java package already written. Check out this servlet lesson. Also be sure to set your response contentType to be "application/vnd.google-earth.kml+xml"

B) Store the kml in hidden fields in a form on the web page. Then use javascript to grab the kml from the form DOM and add it using the functions you mentioned.

I would reccomend option A

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜