I suppose the best way to
understand KML is to look at a
Google Earth KML file. Table 1 shows
a file I’ve edited for one of my near
space flights. Note that I’ve shortened
the number of positions in the sample
file considerably. The usual number of
positions listed in one of my typical
KML files is over 100.
Like HTML, KML commands — or
element names — are written in
brackets, < and >. Parameters for a
particular command are written after
the <COMMAND> begins and before
the </COMMAND> ends.
The first element names I edit are
<DESCRIPTION> and <NAME>.
When the image of a flight path is
clicked on a Google Earth map, the
text entered in these two elements is
displayed. I like to write the mission
name and date in these elements.
Next, I edit the element names
under <LOOKAT>. These seven
elements indicate where in space
to place and point your eyeball.
The <LATITUDE>, <LONGITUDE>,
and <ALTITUDE> element names
indicate the point above the earth
to stare at. The
<RANGE> and <TILT> ■ FIGURE 2
element names indicate the distance and
angle to look from.
The <HEADING>
element name is the
compass direction
your eyeball points.
Since the near
spacecraft’s GPS
altitude is with respect
to mean sea level, the
<ALTITUDEMODE> is
set to ABSOLUTE.
Figure 2 shows my
diagram of what the
<LOOKAT> element
names mean.
The <LOOKAT>
point in the sample
KML file is a location
at the center of the
near spacecraft’s flight
ground track and
half way up to its
maximum altitude. Its
■ FIGURE 3. The
extruded flight path.
tilt is 90 degrees (horizontal), with
a heading of 0 degrees (true north).
The range is equal to the flight
path’s maximum altitude (I sometimes
have to edit this after looking at
the results). A word of caution here.
The altitude and range elements are
in units of meters. Until I realized
that, my flight paths looked awfully
tall and skinny (just like me when I
was younger).
The only name elements modified
under <STYLE> are
<LINESTYLE COLOR>
and <WIDTH>. The
<LINESTYLE COLOR>
element is an eight byte
field. The first two bytes
indicate the transparency
of the line and the
remaining six bytes
indicate its color. A
transparency of hex 00
creates an invisible line
and a hex value of FF
creates a fully opaque
one. The next three pairs
of bytes are for the
colors blue, green, and
red (in that order). In the sample KML
file, the <LINESTYLE COLOR> is set to
ff000000. That draws the flight path as
a fully opaque black line. The
<WIDTH> is set to two just because
that seems to work well.
The last name element modified is
<EXTRUDE>. Extruding a flight path
drops a curtain from the flight path
to the ground. I find the curtain
confusing, so I don’t have it drawn. To
NOT extrude a flight path, type,
TABLE 1
<?xml version=”1.0” encoding=”UTF- 8”?>
<kml xmlns=” http://earth.google.com/kml/2.0”>
<Placemark>
<description>Flight of NearSys 05B</description>
<name> 29 May 2005</name>
<LookAt>
<longitude>-119.78</longitude>
<latitude> 47. 78</latitude>
<altitudeMode>absolute</altitudeMode>
<altitude>13400</altitude>
<range>26800</range>
<tilt> 90.0000</tilt>
<heading>0.000000</heading>
</LookAt>
<visibility>1</visibility>
<open>0</open>
<Style>
<LineStyle>
<color>ff000000</color>
</LineStyle>
<width> 3</width>
<PolyStyle>
<fill>0</fill>
<color>0000ff00</color>
</PolyStyle>
</Style>
<LineString>
<extrude>0</extrude>
<tessellate>0</tessellate>
<altitudeMode>absolute</altitudeMode>
<coordinates>
-119.7523333, 47.9435,1176.219512
-119.7525, 47.94333333,1230.182927
-119.7526667, 47.943,1285.060976
-119.753, 47.9425,1338.109756
-119.7533333, 47.942,1392.987805
-119.7536667, 47.9415,1450
-119.754, 47.94066667,1504.268293
-119.7541667, 47. 94,1560.060976
-119.7545, 47.93933333,1619.207317
●
●
●
●
</coordinates>
</LineString>
</Placemark>
</kml>
March 2007 17