5.0

5.0 | 4 ratings Rate this file 251 Downloads (last 30 days) File Size: 4.56 MB File ID: #34694
image thumbnail

KML Toolbox v1.7 (plot anything to Google Earth)

by Rafael Oliveira

 

20 Jan 2012 (Updated 02 May 2012)

Create KML files and view them in Google Earth. Supports 3D models, contours, overlays, and more...

| Watch this File

File Information
Description

This class-based toolbox allows you to create many different plots in Google Earth, by automatically creating the required xml-based kml files without user interaction.

With it, you can create:
- line plots, scatter plots
- 2D and 3D contours
- 2D and 3D polygons
- 2D and 3D quiver plots
- write text in a given point
- place 3D models
- overlay images
- transfer more complex figures as images
- folders, subfolders,... to aggregate similar plots
- animate 3D models into a pre-defined trajectory

To install the toolbox into your MATLAB path, go to the toolbox directory and run:
>> kml.install

Now with documentation of each function and the available parameters. To view the help, run in MATLAB:
>> kmldoc
or
>> kmldoc kml.plot %or any other of the available plots

If you enjoy it, just drop me an email at kml@rafael.aero saying for what you're using it :).

Inspired by the original Google Earth Toolbox, but implemented using XML objects, which makes it much easier to use. I just checked it in the 2011a release of MATLAB, but it should work in older releases too... (Let me know if not!)

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Google Earth Toolbox

Required Products MATLAB
MATLAB release MATLAB 7.12 (2011a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (10)
22 Jan 2012 Julien

The object oriented version of the google earth toolbox. Wonderful! Thank you so much for sharing...

24 Jan 2012 Travis Knepp

I am wondering why you built functions with the same name as MatLab built-in functions (e.g. plot.m, plot3.m, text.m)? This seems pretty counter-productive. Can you correct me on this?

25 Jan 2012 Rafael Oliveira

Hi Travis. I've used the same name, but they're all encapsulated inside the kml class... So, to call them, you need to create an instance of the kml class, for example:

mykml = kml('Sample plot');

And then use this object "mykml" to plot, as in:

mykml.plot(1:10, sin(1:10));

or

mykml.scatter(rand(100,1),rand(100,1));

02 Feb 2012 scott lee davis

hey this looks great! Why not combine the two versions into the best matlab version? I am building at multilanguage version of the googleearth toolbox and would welcome motivated matlab development and extension.

http://code.google.com/p/googleearthtoolbox/source/browse/#git%2Fmatlab

14 Feb 2012 Michele Williams

This is a great program ... it has provided a great way to visualize my measurement results spatially.

16 Mar 2012 Balam Willemsen

Very nice and useful! I made one very small edit to kml.m to get it to work on the Mac platform. Not sure if Linux has a common tool like start or open that is independent of distro.

        function run(this)
            this.save;
            if (ispc)
                system(['start "kmltoolbox" "' this.filename '"']);
            elseif (ismac)
                system(['open' ' "' this.filename '"']);
            elseif (isunix)
                disp('The KML file has been saved, open it in Google Earth');
            end
            
        end

16 Mar 2012 Rafael Oliveira

Thanks for the tip... I've included it in an updated version, together with a change removing the ~ from the function outputs. Now it should work with some older MATLAB versions too!

10 May 2012 Zeneida

Hello,
There is a way do more contours, I need that more contour lines in the map, but I don't know is it can be. In the contour.m from matlab I can specify the number of lines, but here?????
Thank you

11 May 2012 Rafael Oliveira

Hi Zeneida,
You can do it using the option 'numberOfLevels', as in:

k = kml;
[x,y,z] = peaks;
k.contour(x,y,z, 'numberOfLevels', 20);
k.run;

21 May 2012 Seb Biass

That is really nice, thank you! Any chance for a contourf type function?

Please login to add a comment or rating.
Updates
24 Jan 2012

v1.2: Updated to support both degree and radian inputs.

25 Jan 2012

v 1.3: fixed a small error in the checkUnit function

08 Feb 2012

v1.4 - Fixed some bugs, added documentation, and a method to animate a model in a trajectory (kml.modelTour)

13 Feb 2012

Corrected the image in File Exchange

14 Feb 2012

v1.5: updated scatter and scatter3 to accept an different icons for each point. You must supply them as a cell array with the same size of the latitude and longitude inputs.

16 Mar 2012

v1.6: made it compatible with older versions that do not support ~ as function output. Also added the suggestion of Balam Willemsen, to make run work with OSX... Any suggestions on the Linux side are welcome :)

02 May 2012

v1.7: small correction in the quiver3d function, and implementation of the classic quiver plot in 2D, without using models anymore.

Tag Activity for this File
Tag Applied By Date/Time
google earth Rafael Oliveira 20 Jan 2012 15:18:15
kml Rafael Oliveira 20 Jan 2012 15:18:15
geography Rafael Oliveira 20 Jan 2012 15:18:15
earth Rafael Oliveira 20 Jan 2012 15:18:15
plot Rafael Oliveira 20 Jan 2012 15:18:15
contour Rafael Oliveira 20 Jan 2012 15:18:15
visualization Rafael Oliveira 20 Jan 2012 15:18:15
trajectory Rafael Oliveira 20 Jan 2012 15:18:15
advanced plotting Rafael Oliveira 20 Jan 2012 15:18:15
scatter Rafael Oliveira 20 Jan 2012 15:18:15
kml Jud 14 Mar 2012 22:18:26
quiver Rafael Oliveira 02 May 2012 11:22:21

Contact us at files@mathworks.com