File Exchange

image thumbnail

kml line plot

version 1.6 (2.92 KB) by

Draw nan-separated lines (or a single line) onto Google Earth.

7 Downloads

Updated

View License

This function takes in standard nan-separated arrays (such as for a coastline), and draws them onto Google Earth.

It can also handle a single lon/lat track that has no NaN values (such as a ship or airplane track).

 Syntax:
     KML_LINE(LON, LAT) writes nan-separated lines specified
     in LON and LAT to an output file, doc.kml
     KML_LINE(LON, LAT, NAME) writes nan-separated lines specified
     in LON and LAT to an output file, NAME.kml
     KML_LINE(LON, LAT, NAME, COLOR) writes lines same as above but with
     MATLAB color value (default is 'w').
     KML_LINE(LON, LAT, NAME, WIDTH) writes lines same as above but with
     width WIDTH (default is 1).
     KML_LINE(LON, LAT, NAME, COLOR, WIDTH) writes lines same as above but
     with width WIDTH and color COLOR.

 Input:
     LON: 1-D array of longitude line values. Separate lines are separated
     by a NaN. Must correspond to LAT.
     LAT: 1-D array of latitude line values. Separate lines are separated
     by a NaN. Must correspond to LON.
     NAME: String name of output file (without the .kml extension)
     COLOR: MATLAB color (default is 'w'), supports vector colors.
     WIDTH: int or float width value (default is 1)

 Output:
     This function creates a kml file called NAME.kml in the current
     working directory

 Examples:
     % four different ways of calling kml_line:
     load('palau_coastline.mat');
     kml_line(lon_coast, lat_coast, 'palau_coastline');
     kml_line(lon_coast, lat_coast, 'palau_coastline', 'r');
     kml_line(lon_coast, lat_coast, 'palau_coastline', 1.5);
     kml_line(lon_coast, lat_coast, 'palau_coastline', 'm', 2);

Comments and Ratings (1)

Mathieu

Updates

1.6

Now prints out 10 digits of accuracy as opposed to 4.

1.5

Now uses ge_color function so that the color input can be in standard MATLAB form.

1.4

Major revision on how it handles line styles (now makes use of styleUrl). Also added support for writing a KML without specifying a name.

1.3

Updated file to support changes in the color and/or width of the lines

1.1

updated description to include support for single lines

MATLAB Release
MATLAB 7.10 (R2010a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video