KML Direction of Movement Line

1.2k views Asked by At

I've been working with NASA WorldWind and Google Earth. I'm using a KML placemark for the icon, and I'm hoping to replicate a Header/Leader Line in KML. I want a leader line similar to how the DIRECTION_OF_MOVEMENT line works in WorldWind for it's implementation on 2525 symbology. Basically, the line indicates the direction that the object is moving in and it stays pointing towards that heading no matter the orientation of the map as shown by the black line in the attached screenshot. How can I replicate this using KML in Google Earth?

enter image description here

2

There are 2 answers

6
Andrew C. On BEST ANSWER

Sorry I can't ask for clarification in comments (I don't have enough reputation). I'm assuming that you are looking for a way to enter a heading and have Google Earth automatically point something in that direction, because currently to draw that line you have to calculate start and end coordinates for each heading line that you want to put down.

If that is the case, the only place I found that allowed me to specify heading was IconStyle. This is how I did it:

  1. Create an icon that depicts your heading line pointing up so rotating it 0 degrees points north, such as a vertical line (using an icon has the added bonus of scaling as you zoom in and out on Google Earth)
  2. Use Style and IconStyle to use the icon from step 1.
  3. Use the Style in your Placemark, and add an additional Style to set the heading.

Here is an example implementation below:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<kml xmlns="http://earth.google.com/kml/2.1">
    <Document>
        <Style id="headingexample">
            <IconStyle>
                <scale>1</scale>
                <Icon>
                    <href>http://freevector.co/wp-content/uploads/2013/11/1625-vertical-line3.png</href>
                </Icon>
            </IconStyle>
        </Style>
        <Placemark>
            <styleUrl>#headingexample</styleUrl>
            <Style>
                <IconStyle>
                    <heading>135</heading>
                </IconStyle>
            </Style>
            <Point>
                <coordinates>-99.21,40.01</coordinates>
            </Point>
        </Placemark>
    </Document>
</kml>
2
Ivan Chaer On

What about using a custom floating place-mark coupled with a 3D track?

See it working.

See the NASA Worldwind reference.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<kml xmlns="http://earth.google.com/kml/2.1">
    <Document>

        <!-- Icon -->
        <Style id="tactical_symbol_placemark">
            <IconStyle>
                <scale>4</scale>
                <Icon>
                    <href>http://i.imgur.com/EEhQcPj.png</href>
                </Icon>
            </IconStyle>
        </Style>
        <Placemark>
            <styleUrl>#tactical_symbol_placemark</styleUrl>
            <Point>
                <altitudeMode>relativeToGround</altitudeMode>
                <coordinates>-114.19327,51.4292695,6000</coordinates>
            </Point>
        </Placemark>

        <!-- Line -->
        <Style id="track_line">
            <LineStyle>
                <color>FF000000</color>
                <width>5.0</width>
            </LineStyle>
        </Style>
        <Folder>
            <name>tactical_symbols</name>
            <Placemark>
                <name>testing-Placemark-2</name>
                <styleUrl>#track_line</styleUrl>
                <LineString>
                    <extrude>false</extrude>
                    <altitudeMode>relativeToGround</altitudeMode>
                    <coordinates>-114.19827,51.279256,6000 -114.18827,51.579283,6000</coordinates>
                </LineString>
            </Placemark>
        </Folder>
    </Document>
</kml>