开发者

How can I show subtitles in Google Earth using some sort of overlay?

I'm quite new to programming Google Earth with KML but I've been asked to look into showing subtitles on top of a Google Earth fly-through. I see that there are several types of overlays, but they all seem to assume an image. ScreenOverlay looks like the best bet, as the imagine is displayed relative to the screen, not the globe, but that would still require me to convert each segment of text into an image – possible, but not pretty. Is there a better altern开发者_高级运维ative?


you should have a Placemark with its Point missing. Then put your text in the description field. You can even use CDATA to use html formatting for your text, allowing hyperlinks for your text.

With this method, the text will appear in a balloon. You can change the background colour of it by editing its BalloonStyle. I'm pretty sure you can even make it transparent.


One simple way to solve this is to use some kind of text-to-image cgi script. For example, rather than referencing an image url you pass the script url along with a text argument. e.g.

http://yoursite.com/image.php?text=subtitle-text

The script would then dynamically generate the image and serve it up. If you employ some caching on the server you can make sure that an image is only generated once so that any further calls with the same argument simply serve the pre generated image.

There are plenty of ways to do this - google even provides an API for it!

http://groups.google.com/group/google-chart-api/web/chart-type-for-text-with-outline

For example:

http://chart.apis.google.com/chart?chst=d_text_outline&chld=FFBBBB|16|h|BB0000|b|Hello%20Word


A ScreenOverlay is your best bet for subtitles. With them, you can think of the globe and its movements like a movie or TV show, and the ScreenOverlays are the subtitles that remain in the same location on the screen, regardless of the action.

For your second question, yes, you can only display images as overlays. No text (yet?).

If you are considering the development of a Tour, you can make individual subtitles appear and disappear relatively easily by enabling and disabling them during the recording process.


I am sure this is too late for the author of this question, but I needed to put a project label at the top of the plug in.

Look a the "Custom Controls using Screen Overlays or IFRAME shims" in the Demo Gallery.

I used this example and gave the button some text, disabled the background image and re-positioned the button to the top/middle of the page. I also removed the event handling. I plan to use something other than a button, so that the cursor doesn't change to a finger icon when hovering of the label.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜