View source code of the function ge_plot3() in the MATLAB editor
Google Earth toolbox contents

ge_plot3

Plotting of lines in Earth's atmosphere and space.

Syntaxgo to top

kmlStr = ge_plot3(X,Y,Z)
kmlStr = ge_plot3(X,Y,Z,Parameter,Value)

Descriptiongo to top

kmlStr = ge_plot(X,Y,Z)

When the above syntax is used, ge_plot3() will return the character array kmlStr containing XML-based kml tags. This character array contains the coordinates specified in X,Y and Z that were passed to ge_plot(), as well as information on the appearance of the line. If the kmlStr array is used as part of a *.kml file (see function ge_output()), it can be displayed in Google Earth, displaying a line connecting the points from the input arrays X,Y, and Z (respectively representing Longitude, Latitude, and Elevation; the former two being expressed as decimal degrees, the latter in meters). By default the line is drawn as a 100% opaque, white line of width 1.

kmlStr = ge_plot3(X,Y,Z,Parameter,Value)

A number of options can be set regarding the appearance of the line. Assigning values to the parameters can be accomplished by inclusion of an alternating sequence of parameters and their value. The table below provides an overview of the authorized options. The order in which the parameters are included does not matter, nor does the number of Parameter/Value pairs. Please be aware that Parameter is case-sensitive. Examples are provided further down.

ParameterDescription
'altitudeMode'Specifies which plane of reference to use. Must be one of 'absolute', 'relativeToGround' or 'clampToGround'.
'description'A description of the object can be included using this parameter. Its value must be passed as a character array. Including a description will cause a text balloon to pop up from the map at the object's location. This balloon contains the character array included in 'description'.
'extrude'See Extruding objects.
'forceAsLine'When lines do not end at the location where they started, they are sometimes automatically connected by the OpenGL renderer when displayed in the Google Earth Viewer. By setting this parameter to true, this is avoided by plotting lines from start to end and back. This will force all lines to end at their starting point. Note that this will increase file size. Default is true.
'forceAsLine'When lines do not end at the location where they started, they are sometimes automatically connected by the OpenGL renderer when displayed in the Google Earth Viewer. By setting this parameter to true, this is avoided by plotting lines from start to end and back. This will force all lines to end at their starting point. Note that this will increase file size. Default is true.
'lineColor'Line color specification, including transparency. Color value format must be passed as a character array according to the format string 'TTRRGGBB', with 'TT' representing transparency; 'RR', 'GG', and 'BB' representing red, green, and blue colors, respectively. Intensity values are denoted as two-digit hexadecimal numbers ranging from 00 to FF. For example, '80FF0000' is semi-transparent red and 'FF0000FF' is fully opaque blue.
'lineWidth'Line width specification. Must be passed as a 1x1 numerical array.
'msgToScreen'Defines whether verbose feedback is provided by the function when it is accessed and when it finishes. Default is false (which is equivalent to logical(0), but quicker).
'name'This character array will be used within the Google Earth Viewer 'Places' pane to identify objects.
'snippet'A short description of the feature. In Google Earth, this description is displayed in the Places panel under the name of the feature. If a Snippet is not supplied, the first two lines of the description are used
'tessellate'See Tessellation.
'timeSpanStart'See Dynamic visualization.
'timeSpanStop'See Dynamic visualization.
'visibility'Defines whether the object is visible. Must be passed as numerical value 1 or 0.

Remarksgo to top

Latitudes and longitudes should be passed in units of decimal degrees (also known as fractional degrees). Google Earth uses Simple Cylindrical projection (also known as Plate Carée) with a WGS84 datum. Altitudes are in meters.

A line can consist of multiple sections; these will all be assigned identical properties such as line width and color. When different lines should be assigned different line styles, use multiple calls to ge_plot3() with different line style parameters. Disconnected lines with identical linestyles can be generated using coordinate vectors separated by NaNs.

Examplesgo to top

See the demo file demo_ge_plot3 for more details.


t = [0:pi/50:10*pi];

kmlStr = ge_plot3(sin(t),cos(t),t*1e6,...
                          'lineWidth',1.2,...
                          'lineColor','ff32a4ff');
                            
                            
ge_output('demo_ge_plot3.kml',kmlStr);

The above lines of code will display as follows when viewed in Google Earth: