kml.contour
Create a contour of altitude in a grid defined by longitude and latitude. Similar to the built-in contour function.
Contents
Syntax
kml.contour(long, lat, alt) kml.contour(...,'PropertyName',PropertyValue,...)
Description
Creates a flat contour plot of altitude in a grid defined by longitude vs. latitude, similar to the built-in contour 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 contour properties using name-value pairs:
kml.contour(...,'PropertyName',PropertyValue,...)
Properties
Property Name | Type | Description |
---|---|---|
'name' | string | Name of the plot inside the kml file |
'description' | string | A short description of what the plot represents |
'visibility' | true/false | Control the initial visibility of the plot |
'colorMap' | string name of a valid colormap function | Defines in which colormap the contour will be plotted. Example of valid inputs: 'jet', 'hsv', 'hot', 'cool', 'spring', 'summer', 'autumn', 'winter', 'gray', 'bone', 'copper', 'pink' |
'numberOfLevels' | double or 'auto' | Defines number of levels in which the altitude input should be split into. Valid inputs are either the desired number of levels or 'auto' |
'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' |
'timeStamp' | kml date string | Associates the contour 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 contour 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 contour 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 contour plot to the kml [x,y,z] = peaks(200); k.contour(180*x/3,90*y/3,z,'numberOfLevels',40); % 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)