Text Overlay in Google Earth KML

2020-03-26 05:17发布

问题:

I would like to add a date/time that the KML file was last updated to be displayed as an overaly in Google Earth, is there anyway this could be done?

I would be looking at updating text in a KML file and then this being displayed in google earth.

Many Thanks.

回答1:

One trick is using the Google Chart API to dynamically create images from text and using that as a screen overlay image in Google Earth.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
    <ScreenOverlay>
        <Icon>
            <href><![CDATA[http://chart.apis.google.com/chart?chst=d_text_outline&chld=FFBBBB|16|h|BB0000|b|Hello%20Word]]></href>
        </Icon>
        <overlayXY x="0.8" xunits="fraction" y="0.8" yunits="fraction"/>
        <screenXY x="0.8" xunits="fraction" y="0.8" yunits="fraction"/>
    </ScreenOverlay>
</kml>

A screen overlay with embedded images is used in the Paleoglobe KML: http://www.geology.sdsu.edu/kmlgeology/kmz/paleoglobe/paleogeography.kmz

There are many websites that create images out of text for labels which you embed in a KMZ file and refer to from you KML.

Also, if you want text to appear as a label on the ground at a fixed location then you can use same trick with a GroundOverlay or simply create a Placemark with a name (which is shown on map at that location) and a Style suppressing the icon.