specify a file name and a matrix containing latitude / longitude data and the program outputs a KML track file viewable in Google Earth.
Patrick Robinson (2020). Latitude Longitude to KML (https://www.mathworks.com/matlabcentral/fileexchange/12225-latitude-longitude-to-kml), MATLAB Central File Exchange. Retrieved .
Added some changes, so it works in Google Earth 2018 Version:
Be carfeul with the order of lat/long (function flips it)
header=['<kml xmlns="http://earth.google.com/kml/2.0"><Placemark><description>"' name '"</description><LineString><tessellate>1</tessellate><coordinates>'];
fid = fopen([name '.kml'], 'wt');
fprintf(fid, '%s \n',header);
fprintf(fid, '%.7f,%.7f,0.0\n', d);
fprintf(fid, '%s', footer);
It works great. I just used it. I have location traces collcted for few hours, I will try to enhance this work by enabling reading of corresponding timestamp and get more information from the map file.
@Fraser Dickson check following link
Thanks a TON! :D
Hi This seems to work great but how do i just plot my lat longs rather than join them up into a track. Can this be done?
works great. thanks
but I can't plot all the lat long in the Google Earth (path).
Any way to do it? My file looks something like this...I assume it will plot the path in the google earth using this file....any help?
<LineString id="POINT string">
-1.1929924500, 52.9404052600, 0.0
-1.1929924700, 52.9403052500, 0.0
-1.1929924800, 52.9402052300, 0.0
-1.1929925000, 52.9403052200, 0.0
-1.1929925100, 52.9403052000, 0.0
wang tan: look for the wgs84 file somebody posted on this site.
i hope to find a file converts Lat/Long to X-Y coordinate
This code does work. Thanks.
an basic but exellent code
it is simple, but it works great!