Search code examples
google-earth-plugin

GE plugin tethered placemark


I am trying to code a tethered placemark in the plugin just like the ones in google earth but I can't find any reference to a single line going from ground up to the pushpin. Here is what I have so far: what am I missing?

var placemark = ge.createPlacemark("");
var point = ge.createPoint("");
point.setLatitude(41.0);
point.setLongitude(-88.0);
placemark.setGeometry(point);
point.setAltitudeMode(ge.ALTITUDE_RELATIVE_TO_GROUND);
point.setAltitude(500);
ge.getFeatures().appendChild(placemark);

Any help would be highly appreciated Thanks in advance.


Solution

  • You just need to set the extrude property of the KML point to true. i.e.

    point.setExtrude(true);
    

    This specifies whether to connect the geometry to the ground with a "tail" as you require.

    It is also worth noting that for extrude to have any effect the altitudeMode of the point must be either relativeToGround, relativeToSeaFloor, or absolute.

    Also, you can set the properties of the point using the shorthand set method. i.e.

    // latitude, longitude, altitude, altitudeMode, extrude, tessellate 
    point.set(41, -88, 500, ge.ALTITUDE_RELATIVE_TO_GROUND, true, false);