MATLAB: How to create a KML file using Mapping Toolbox in MATLAB

earthgooglekmlkmlwritepointMapping Toolbox

How can I use MATLAB with Mapping Toolbox to generate a KML file for use with Google Earth? 

Best Answer

You can do this by using kmlwritepoint function:
For example, the following code will create a KML file with the cities Adana, Alexandria, and Algiers:
 
latitudes = [37.0613, 31.3044, 36.7869];
longitudes = [35.3894, 30.4097, 3.0396];
names = {'Adana', 'Alexandria', 'Algiers'};
filename = 'cities.kml';
kmlwritepoint(filename, latitudes, longitudes, 'Name', names);