kml.plot

Create 2D plot of longitude vs. latitude. Similar to the built-in plot function.

Contents

Syntax

kml.plot(long, lat)
kml.plot(...,'PropertyName',PropertyValue,...)

Description

Creates a 2D plot of longitude vs. latitude, similar to the built-in plot function.

The units for latitude and longitude are normally given in degrees, but this can be changed by calling: kml.useDegrees; or kml.useRadians; before plotting.

It is possible to fine tune the plot properties using name-value pairs:

kml.plot(...,'PropertyName',PropertyValue,...)

Properties

Property NameTypeDescription
'name' string Name of the plot inside the kml file
'id' string Internal id of this plot inside the kml
'description' string A short description of what the plot represents
'visibility' true/false Control the initial visibility of the plot
'lineColor' kml color string Defines the color of the line. Must be a valid hex color string input, in the style AABBGGRR
'polyColor' kml color string Defines the color of the extruded polygon, if 'extrude' is set to true. Must be a valid hex color string input, in the style AABBGGRR
'lineWidth' double Defines the width of the line. Set to zero to show no line.
'altitude' double Altitude where the 2D line should be plotted. Input in meters.
'altitudeMode' string Choose if the altitude value is absolute to the earth model, relative to the ground level, or should be clamped to the ground. Valid inputs: 'absolute', 'relativeToGround', 'clampToGround'
'extrude' true/false Enables or disables extruding the line to the ground.
'tessellate' true/false Tesselates the line into the ground, so that it will be visible within the terrain contour
'timeStamp' kml date string Associates the plot to a moment in time. Should not be used together with timeSpan. Should be a string in the XML time format (more information available here)
'timeSpanBegin' kml date string Defines the moment in time where the plot starts to exist. Should not be used together with timeStamp. Should be a string in the XML time format (more information available here)
'timeSpanEnd' kml date string Defines the moment in time where the plot finishes to exist. Should not be used together with timeStamp. Should be a string in the XML time format (more information available here)

Example

% Create a new kml object
k = kml('my kml file');

% Plot a sample 2D curve to the kml
t = linspace(0,360,1000);
k.plot(20*t, 90*cosd(t/2), 'altitude', 1e6, 'altitudeMode','absolute','lineWidth',10, 'name','plot test');

% Save the kml and open it in Google Earth
k.run;

This is the result of running this example:

This file is part of the kml toolbox. Copyright 2012 Rafael Fernandes de Oliveira (rafael@rafael.aero)